summaryrefslogtreecommitdiff
path: root/accounts/gkleen@sif/shell/quickshell
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2025-09-11 22:52:35 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2025-09-11 22:52:35 +0200
commitdd2df931a3be1a6518c1e9fbff438de4274456cd (patch)
tree50d203bcaa0e2d3af8f2d88536e38e0f0ee81c67 /accounts/gkleen@sif/shell/quickshell
parentaebd3235d755cb1ff95995b461e497fea2d52e8b (diff)
downloadnixos-dd2df931a3be1a6518c1e9fbff438de4274456cd.tar
nixos-dd2df931a3be1a6518c1e9fbff438de4274456cd.tar.gz
nixos-dd2df931a3be1a6518c1e9fbff438de4274456cd.tar.bz2
nixos-dd2df931a3be1a6518c1e9fbff438de4274456cd.tar.xz
nixos-dd2df931a3be1a6518c1e9fbff438de4274456cd.zip
...
Diffstat (limited to 'accounts/gkleen@sif/shell/quickshell')
-rw-r--r--accounts/gkleen@sif/shell/quickshell/Lockscreen.qml34
-rw-r--r--accounts/gkleen@sif/shell/quickshell/NiriIdle.qml30
-rw-r--r--accounts/gkleen@sif/shell/quickshell/WorkspaceSwitcher.qml2
-rw-r--r--accounts/gkleen@sif/shell/quickshell/shell.qml1
4 files changed, 66 insertions, 1 deletions
diff --git a/accounts/gkleen@sif/shell/quickshell/Lockscreen.qml b/accounts/gkleen@sif/shell/quickshell/Lockscreen.qml
index 8e739359..e4f8e1c9 100644
--- a/accounts/gkleen@sif/shell/quickshell/Lockscreen.qml
+++ b/accounts/gkleen@sif/shell/quickshell/Lockscreen.qml
@@ -38,6 +38,38 @@ Scope {
38 function getLocked(): bool { return lock.locked; } 38 function getLocked(): bool { return lock.locked; }
39 } 39 }
40 40
41 Connections {
42 target: Custom.Systemd
43 function onSleep(before: bool) {
44 console.log(`received prepare for sleep ${before}`);
45 if (before)
46 lock.locked = true;
47 }
48 function onLock() { lock.locked = true; }
49 function onUnlock() { lock.locked = false; }
50 }
51
52 IdleMonitor {
53 id: idleMonitor
54 enabled: !lock.secure
55 timeout: 600
56 respectInhibitors: true
57
58 onIsIdleChanged: {
59 if (idleMonitor.isIdle)
60 lock.locked = true;
61 }
62 }
63
64 Custom.SystemdInhibitor {
65 enabled: !lock.secure
66
67 what: Custom.SystemdInhibitorParams.Sleep
68 who: "quickshell"
69 why: "Lock session"
70 mode: Custom.SystemdInhibitorParams.Delay
71 }
72
41 WlSessionLock { 73 WlSessionLock {
42 id: lock 74 id: lock
43 75
@@ -56,6 +88,8 @@ Scope {
56 } 88 }
57 } 89 }
58 90
91 onSecureStateChanged: Custom.Systemd.lockedHint = lock.secure
92
59 WlSessionLockSurface { 93 WlSessionLockSurface {
60 id: lockSurface 94 id: lockSurface
61 95
diff --git a/accounts/gkleen@sif/shell/quickshell/NiriIdle.qml b/accounts/gkleen@sif/shell/quickshell/NiriIdle.qml
new file mode 100644
index 00000000..faa77c3f
--- /dev/null
+++ b/accounts/gkleen@sif/shell/quickshell/NiriIdle.qml
@@ -0,0 +1,30 @@
1import QtQml
2import Quickshell
3import Quickshell.Wayland
4import qs.Services
5import Custom as Custom
6
7Scope {
8 IdleMonitor {
9 id: idleMonitor30
10 timeout: 30
11
12 onIsIdleChanged: Custom.Systemd.setIdleHint(idleMonitor30.isIdle)
13 }
14 IdleMonitor {
15 id: idleMonitor540
16 timeout: 540
17
18 onIsIdleChanged: {
19 if (idleMonitor540.isIdle)
20 NiriService.sendCommand({ "Action": "PowerOffMonitors" });
21 }
22 }
23 Connections {
24 target: Custom.Systemd
25 function onSleep(before: bool) {
26 if (!before)
27 NiriService.sendCommand({ "Action": "PowerOnMonitors" });
28 }
29 }
30}
diff --git a/accounts/gkleen@sif/shell/quickshell/WorkspaceSwitcher.qml b/accounts/gkleen@sif/shell/quickshell/WorkspaceSwitcher.qml
index c8c017c3..4cbebcc9 100644
--- a/accounts/gkleen@sif/shell/quickshell/WorkspaceSwitcher.qml
+++ b/accounts/gkleen@sif/shell/quickshell/WorkspaceSwitcher.qml
@@ -48,7 +48,7 @@ Row {
48 cursorShape: Qt.PointingHandCursor 48 cursorShape: Qt.PointingHandCursor
49 enabled: true 49 enabled: true
50 onClicked: { 50 onClicked: {
51 NiriService.sendCommand({ "Action": { "FocusWorkspace": { "reference": { "Id": workspaceData.id } } } }, _ => {}) 51 NiriService.sendCommand({ "Action": { "FocusWorkspace": { "reference": { "Id": workspaceData.id } } } }, _ => {});
52 } 52 }
53 53
54 Rectangle { 54 Rectangle {
diff --git a/accounts/gkleen@sif/shell/quickshell/shell.qml b/accounts/gkleen@sif/shell/quickshell/shell.qml
index 0fa45f79..693d741f 100644
--- a/accounts/gkleen@sif/shell/quickshell/shell.qml
+++ b/accounts/gkleen@sif/shell/quickshell/shell.qml
@@ -41,6 +41,7 @@ ShellRoot {
41 } 41 }
42 42
43 Lockscreen {} 43 Lockscreen {}
44 NiriIdle {}
44 45
45 VolumeOSD {} 46 VolumeOSD {}
46 BrightnessOSD {} 47 BrightnessOSD {}