aboutsummaryrefslogtreecommitdiff
path: root/.config/swayrbar/scripts/idle-toggle
diff options
context:
space:
mode:
authorLuca Matei Pintilie <luca@lucamatei.com>2024-07-11 17:53:42 +0000
committerLuca Matei Pintilie <luca@lucamatei.com>2024-07-11 17:53:42 +0000
commitd7a21e259b80010ce7368e8aaa0863886a947085 (patch)
tree73584e30416fec4264aeea9b1a20aae9846f02ee /.config/swayrbar/scripts/idle-toggle
parent9c0ae0039bb239291b0fdf42a2a205aff0356916 (diff)
downloaddotfiles-d7a21e259b80010ce7368e8aaa0863886a947085.tar
dotfiles-d7a21e259b80010ce7368e8aaa0863886a947085.tar.gz
dotfiles-d7a21e259b80010ce7368e8aaa0863886a947085.tar.bz2
dotfiles-d7a21e259b80010ce7368e8aaa0863886a947085.tar.lz
dotfiles-d7a21e259b80010ce7368e8aaa0863886a947085.tar.xz
dotfiles-d7a21e259b80010ce7368e8aaa0863886a947085.tar.zst
dotfiles-d7a21e259b80010ce7368e8aaa0863886a947085.zip
swayrbar: add config
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
+