diff options
Diffstat (limited to 'scripts/toggle-idle')
| -rwxr-xr-x | scripts/toggle-idle | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/scripts/toggle-idle b/scripts/toggle-idle new file mode 100755 index 0000000..c5334bf --- /dev/null +++ b/scripts/toggle-idle @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +chk_idle=$(pgrep swayidle) +if [ -n "$chk_idle" ]; then + pkill swayidle && notify-send "SWAYIDLE" "Idling stopped" +else + setsid -f swayidle -w \ + timeout 600 'swaylock -f' \ + timeout 630 'niri msg action power-off-monitors' \ + resume 'niri msg action power-on-monitors' \ + before-sleep 'swaylock -f' && \ + notify-send "SWAYIDLE" "Idling started" +fi |
