summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/IdleMonitors.qml37
-rw-r--r--modules/lock/Lock.qml1
2 files changed, 38 insertions, 0 deletions
diff --git a/modules/IdleMonitors.qml b/modules/IdleMonitors.qml
new file mode 100644
index 0000000..ed929c4
--- /dev/null
+++ b/modules/IdleMonitors.qml
@@ -0,0 +1,37 @@
+import "lock"
+import qs.config
+import qs.services
+import Quickshell
+import Quickshell.Wayland
+
+Scope {
+ id: root
+
+ required property Lock lock
+
+ IdleMonitor {
+ timeout: Config.general.idle.lockTimeout
+ onIsIdleChanged: {
+ if (isIdle)
+ root.lock.lock.locked = true;
+ }
+ }
+
+ IdleMonitor {
+ timeout: Config.general.idle.dpmsTimeout
+ onIsIdleChanged: {
+ if (isIdle)
+ Hypr.dispatch("dpms off");
+ else
+ Hypr.dispatch("dpms on");
+ }
+ }
+
+ IdleMonitor {
+ timeout: Config.general.idle.sleepTimeout
+ onIsIdleChanged: {
+ if (isIdle)
+ Quickshell.execDetached(["systemctl", "suspend-then-hibernate"]);
+ }
+ }
+}
diff --git a/modules/lock/Lock.qml b/modules/lock/Lock.qml
index fc0bff8..6fd5277 100644
--- a/modules/lock/Lock.qml
+++ b/modules/lock/Lock.qml
@@ -6,6 +6,7 @@ import Quickshell.Io
import Quickshell.Wayland
Scope {
+ property alias lock: lock
WlSessionLock {
id: lock