feat: add idle monitor

Replaces hypridle
This commit is contained in:
2 * r + 2 * t 2025-09-17 23:15:47 +10:00
parent f484642971
commit 24922be5e9
5 changed files with 56 additions and 1 deletions

View file

@ -252,6 +252,11 @@ default, you must create it manually.
"apps": {
"terminal": ["foot"],
"audio": ["pavucontrol"]
},
"idle": {
"lockTimeout": 180,
"dpmsTimeout": 300,
"sleepTimeout": 600
}
},
"background": {

View file

@ -2,6 +2,7 @@ import Quickshell.Io
JsonObject {
property Apps apps: Apps {}
property Idle idle: Idle {}
component Apps: JsonObject {
property list<string> terminal: ["foot"]
@ -9,4 +10,10 @@ JsonObject {
property list<string> playback: ["mpv"]
property list<string> explorer: ["thunar"]
}
component Idle: JsonObject {
property real lockTimeout: 180 // 3 mins
property real dpmsTimeout: 300 // 5 mins
property real sleepTimeout: 600 // 10 mins
}
}

37
modules/IdleMonitors.qml Normal file
View file

@ -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"]);
}
}
}

View file

@ -6,6 +6,7 @@ import Quickshell.Io
import Quickshell.Wayland
Scope {
property alias lock: lock
WlSessionLock {
id: lock

View file

@ -13,7 +13,12 @@ ShellRoot {
Background {}
Drawers {}
AreaPicker {}
Lock {}
Lock {
id: lock
}
Shortcuts {}
IdleMonitors {
lock: lock
}
}