summaryrefslogtreecommitdiff
path: root/scripts/system/idle-sleep
diff options
context:
space:
mode:
authorJack Jamison <jackqjamison@gmail.com>2026-05-22 20:51:22 -0400
committerJack Jamison <jackqjamison@gmail.com>2026-05-22 20:51:22 -0400
commit8d71a22569315b56144799b96f7d2dec7cc0f1c9 (patch)
tree102e0575499c9e4c825af4463da9a129189b6e1d /scripts/system/idle-sleep
parent825e81343502ae9ad15a70c7f52634617d865b6d (diff)
better scripts and sleep toggle
Diffstat (limited to 'scripts/system/idle-sleep')
-rwxr-xr-xscripts/system/idle-sleep20
1 files changed, 20 insertions, 0 deletions
diff --git a/scripts/system/idle-sleep b/scripts/system/idle-sleep
new file mode 100755
index 0000000..3d1dbd9
--- /dev/null
+++ b/scripts/system/idle-sleep
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+sway_idle() {
+ swayidle timeout 300 sleep-computer
+}
+
+if [ -n "$1" ] && [ $1 = "-t" ]; then
+ # toggle
+ if pgrep --quiet swayidle; then
+ notify-send "Idle Disabled" "Computer will not sleep when idle"
+ pkill swayidle
+ else
+ notify-send "Idle Enabled" "Computer will sleep when idle"
+ sway_idle
+ fi
+else
+ # start
+ sway_idle
+fi
+