forked from Shinonome/dots-hyprland
cheatsheet: dont create multiple for each monitor
This commit is contained in:
@@ -15,14 +15,9 @@ import Quickshell.Hyprland
|
|||||||
Scope { // Scope
|
Scope { // Scope
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
Variants { // Window repeater
|
|
||||||
id: cheatsheetVariants
|
|
||||||
model: Quickshell.screens
|
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
id: cheatsheetLoader
|
id: cheatsheetLoader
|
||||||
active: false
|
active: false
|
||||||
property var modelData
|
|
||||||
|
|
||||||
sourceComponent: PanelWindow { // Window
|
sourceComponent: PanelWindow { // Window
|
||||||
id: cheatsheetRoot
|
id: cheatsheetRoot
|
||||||
@@ -39,8 +34,6 @@ Scope { // Scope
|
|||||||
function hide() {
|
function hide() {
|
||||||
cheatsheetLoader.active = false
|
cheatsheetLoader.active = false
|
||||||
}
|
}
|
||||||
|
|
||||||
screen: modelData
|
|
||||||
exclusiveZone: 0
|
exclusiveZone: 0
|
||||||
implicitWidth: cheatsheetBackground.width + Appearance.sizes.elevationMargin * 2
|
implicitWidth: cheatsheetBackground.width + Appearance.sizes.elevationMargin * 2
|
||||||
implicitHeight: cheatsheetBackground.height + Appearance.sizes.elevationMargin * 2
|
implicitHeight: cheatsheetBackground.height + Appearance.sizes.elevationMargin * 2
|
||||||
@@ -164,30 +157,20 @@ Scope { // Scope
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
IpcHandler {
|
IpcHandler {
|
||||||
target: "cheatsheet"
|
target: "cheatsheet"
|
||||||
|
|
||||||
function toggle(): void {
|
function toggle(): void {
|
||||||
for (let i = 0; i < cheatsheetVariants.instances.length; i++) {
|
cheatsheetLoader.active = !cheatsheetLoader.active
|
||||||
const loader = cheatsheetVariants.instances[i];
|
|
||||||
loader.active = !loader.active;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function close(): void {
|
function close(): void {
|
||||||
for (let i = 0; i < cheatsheetVariants.instances.length; i++) {
|
cheatsheetLoader.active = false
|
||||||
const loader = cheatsheetVariants.instances[i];
|
|
||||||
loader.active = false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function open(): void {
|
function open(): void {
|
||||||
for (let i = 0; i < cheatsheetVariants.instances.length; i++) {
|
cheatsheetLoader.active = true
|
||||||
const loader = cheatsheetVariants.instances[i];
|
|
||||||
loader.active = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,10 +179,7 @@ Scope { // Scope
|
|||||||
description: "Toggles cheatsheet on press"
|
description: "Toggles cheatsheet on press"
|
||||||
|
|
||||||
onPressed: {
|
onPressed: {
|
||||||
for (let i = 0; i < cheatsheetVariants.instances.length; i++) {
|
cheatsheetLoader.active = !cheatsheetLoader.active;
|
||||||
const loader = cheatsheetVariants.instances[i];
|
|
||||||
loader.active = !loader.active;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,10 +188,7 @@ Scope { // Scope
|
|||||||
description: "Opens cheatsheet on press"
|
description: "Opens cheatsheet on press"
|
||||||
|
|
||||||
onPressed: {
|
onPressed: {
|
||||||
for (let i = 0; i < cheatsheetVariants.instances.length; i++) {
|
cheatsheetLoader.active = true;
|
||||||
const loader = cheatsheetVariants.instances[i];
|
|
||||||
loader.active = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -220,10 +197,7 @@ Scope { // Scope
|
|||||||
description: "Closes cheatsheet on press"
|
description: "Closes cheatsheet on press"
|
||||||
|
|
||||||
onPressed: {
|
onPressed: {
|
||||||
for (let i = 0; i < cheatsheetVariants.instances.length; i++) {
|
cheatsheetLoader.active = false;
|
||||||
const loader = cheatsheetVariants.instances[i];
|
|
||||||
loader.active = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user