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