aboutsummaryrefslogtreecommitdiff
path: root/.config/swayrbar/scripts/idle-toggle
diff options
context:
space:
mode:
Diffstat (limited to '.config/swayrbar/scripts/idle-toggle')
-rwxr-xr-x.config/swayrbar/scripts/idle-toggle11
1 files changed, 11 insertions, 0 deletions
diff --git a/.config/swayrbar/scripts/idle-toggle b/.config/swayrbar/scripts/idle-toggle
new file mode 100755
index 0000000..fd1a796
--- /dev/null
+++ b/.config/swayrbar/scripts/idle-toggle
@@ -0,0 +1,11 @@
+#!/usr/bin/env sh
+pid_file="/tmp/wayland-idle-inhibitor-$(id --user).pid"
+pid=$(cat "${pid_file}")
+if [ -n "${pid}" ]
+then
+ kill -- "${pid}"
+ rm "${pid_file}"
+else
+ nohup "${HOME}/.config/swayrbar/scripts/wayland-idle-inhibitor.py" > /dev/null 2>&1 & echo $! > "${pid_file}"
+fi
+