dotfiles-old/.local/scripts/caffeine.sh

18 lines
339 B
Bash
Raw Normal View History

2022-03-10 03:42:22 +00:00
#!/bin/sh
if [ "$1" = "on" ]; then
notify-send "caffeine.sh" 'Screen timeout is disabled.'
xset -dpms
xset s off
pkill xautolock
else
notify-send "caffeine.sh" "Screen timeout is enabled."
xset +dpms
xset s on
if [ -z "$(pgrep xautolock)" ]; then
xautolock -time 30 -locker slock &
fi
fi