aboutsummaryrefslogtreecommitdiff
path: root/.config/yambar/scripts/idleinhibit.sh
diff options
context:
space:
mode:
authorJustine Smithies <justine@smithies.me.uk>2023-10-11 18:21:52 +0100
committerJustine Smithies <justine@smithies.me.uk>2023-10-11 18:21:52 +0100
commit786f9c22fab19de866566de4c7933aef416a1462 (patch)
tree512c3563b43a511171979604d6a2a09a4b68c50a /.config/yambar/scripts/idleinhibit.sh
parentba6e0a870faa3306b1e15bd03460b2faa30ceb37 (diff)
Switched to River
Diffstat (limited to '.config/yambar/scripts/idleinhibit.sh')
-rwxr-xr-x.config/yambar/scripts/idleinhibit.sh36
1 files changed, 36 insertions, 0 deletions
diff --git a/.config/yambar/scripts/idleinhibit.sh b/.config/yambar/scripts/idleinhibit.sh
new file mode 100755
index 0000000..90dfcb2
--- /dev/null
+++ b/.config/yambar/scripts/idleinhibit.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+# River swayidle toggle
+function toggle {
+if pgrep "swayidle" > /dev/null
+then
+ pkill swayidle
+ notify-send -r 5556 -u normal " Swayidle Inactive"
+else
+ swayidle -w \
+ timeout 300 'swaylock -f -i ~/.cache/wallpaper' \
+ timeout 600 'wlopm --off \*;swaylock -F -i ~/.cache/wallpaper' resume 'wlopm --on \*' \
+ before-sleep 'swaylock -f -i $wallpaper' &
+ notify-send -r 5556 -u normal " Swayidle Active"
+fi
+}
+
+case $1 in
+ toggle)
+ toggle
+ ;;
+ *)
+ while true; do
+ if pgrep "swayidle" > /dev/null
+ then
+ icon=""
+ else
+ icon=""
+ fi
+ echo "idleinhibit|string|$icon"
+ echo ""
+ sleep 1
+ done
+ ;;
+esac
+exit 0