quickshell lets gooo
This commit is contained in:
65
dots/quickshell/modules/Shortcuts.qml
Normal file
65
dots/quickshell/modules/Shortcuts.qml
Normal file
@@ -0,0 +1,65 @@
|
||||
import "root:/widgets"
|
||||
import "root:/services"
|
||||
import Quickshell
|
||||
import Quickshell.Io
|
||||
|
||||
Scope {
|
||||
id: root
|
||||
|
||||
property bool launcherInterrupted
|
||||
|
||||
CustomShortcut {
|
||||
name: "showall"
|
||||
description: "Toggle launcher, dashboard and osd"
|
||||
onPressed: {
|
||||
const v = Visibilities.getForActive();
|
||||
v.launcher = v.dashboard = v.osd = !(v.launcher || v.dashboard || v.osd);
|
||||
}
|
||||
}
|
||||
|
||||
CustomShortcut {
|
||||
name: "session"
|
||||
description: "Toggle session menu"
|
||||
onPressed: {
|
||||
const visibilities = Visibilities.getForActive();
|
||||
visibilities.session = !visibilities.session;
|
||||
}
|
||||
}
|
||||
|
||||
CustomShortcut {
|
||||
name: "launcher"
|
||||
description: "Toggle launcher"
|
||||
onPressed: root.launcherInterrupted = false
|
||||
onReleased: {
|
||||
if (!root.launcherInterrupted) {
|
||||
const visibilities = Visibilities.getForActive();
|
||||
visibilities.launcher = !visibilities.launcher;
|
||||
}
|
||||
root.launcherInterrupted = false;
|
||||
}
|
||||
}
|
||||
|
||||
CustomShortcut {
|
||||
name: "launcherInterrupt"
|
||||
description: "Interrupt launcher keybind"
|
||||
onPressed: root.launcherInterrupted = true
|
||||
}
|
||||
|
||||
IpcHandler {
|
||||
target: "drawers"
|
||||
|
||||
function toggle(drawer: string): void {
|
||||
if (list().split("\n").includes(drawer)) {
|
||||
const visibilities = Visibilities.getForActive();
|
||||
visibilities[drawer] = !visibilities[drawer];
|
||||
} else {
|
||||
console.warn(`[IPC] Drawer "${drawer}" does not exist`);
|
||||
}
|
||||
}
|
||||
|
||||
function list(): string {
|
||||
const visibilities = Visibilities.getForActive();
|
||||
return Object.keys(visibilities).filter(k => typeof visibilities[k] === "boolean").join("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user