diff options
Diffstat (limited to 'accounts/gkleen@sif/shell/quickshell')
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 @@ | |||
1 | import QtQml | ||
2 | import Quickshell | ||
3 | import Quickshell.Wayland | ||
4 | import qs.Services | ||
5 | import Custom as Custom | ||
6 | |||
7 | Scope { | ||
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 {} |