diff options
Diffstat (limited to 'modules/IdleMonitors.qml')
| -rw-r--r-- | modules/IdleMonitors.qml | 37 |
1 files changed, 37 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"]); + } + } +} |