vincentbernat.i3wm-configur.../bin/xss-lock

51 lines
1.4 KiB
Text
Raw Normal View History

#!/bin/bash
me="$(readlink -f "$0")"
2015-06-17 08:46:28 +02:00
timeout=300
2014-09-12 21:23:15 +02:00
notify=10
configure() {
xset s $((timeout - notify)) $notify
xset dpms $((timeout * 3)) $((timeout * 4)) $((timeout * 5))
}
unconfigure() {
xset s 0
xset dpms 0 0 0
}
case "$1" in
start)
configure
exec xss-lock -n "$me notify" -l $me lock
;;
dim|notify)
echo "$(date --rfc-3339=seconds) $me: notify: start"
pkill -STOP redshift
trap 'pkill -CONT redshift' EXIT
trap 'kill %%; exit 0' HUP
trap 'sleep 1s; kill %%; exit 0' TERM
outputs=$(xrandr -q | sed -n 's/\([^ ]*\) connected .*/\1/p')
for i in $(seq 0.7 -0.01 0.1); do
for out in $outputs; do
xrandr --output $out --brightness $i
done
sleep 0.02
done
echo "$(date --rfc-3339=seconds) $me: notify: end"
sleep infinity &
wait
;;
lock)
# Something may have mendled with screensaver settings
configure
# First, stop any music player
xdotool key XF86AudioStop
2014-12-11 08:32:21 +01:00
# Then, lock screen
2014-09-14 11:03:45 +02:00
echo "$(date --rfc-3339=seconds) $me: lock: lock screen"
pkill compton
i3lock -n -e -i $HOME/.cache/awesome/current-wallpaper.png -t -f
2020-01-17 09:58:07 +01:00
~/.config/awesome/bin/compton &
2014-09-14 11:03:45 +02:00
echo "$(date --rfc-3339=seconds) $me: lock: unlock screen"
;;
esac