tileos-settings-qtile/usr/share/qtile/scripts/idle-inhibit

38 lines
901 B
Bash
Executable file

#!/bin/bash
# Qtile swayidle toggle
function toggle {
if pgrep "swayidle" > /dev/null
then
pkill swayidle
notify-send -r 5556 -u normal " Screensaver Disabled"
else
cd /tmp
grim screen.png
# Delete existing image
rm screen-out.png
#Adds a blur and vignette
ffmpeg -i screen.png -vf "gblur=sigma=10, vignette=PI/5" -c:a copy screen-out.png
swayidle \
timeout 5 'qtile cmd-obj -o core -f hide_cursor' resume 'qtile cmd-obj -o core -f unhide_cursor' \
timeout 300 'swaylock -f -i screen-out.png' \
timeout 600 'wlopm --off \*' resume 'wlopm --on \*' &
notify-send -r 5556 -u normal " Screensaver Enabled"
fi
}
case $1 in
toggle)
toggle
;;
*)
if pgrep "swayidle" > /dev/null
then
icon=""
else
icon=""
fi
printf "%s" "$icon"
;;
esac