aboutsummaryrefslogtreecommitdiff
path: root/.config/yambar/scripts/idleinhibit.sh
diff options
context:
space:
mode:
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