lock: don't dim, use a notification

One time out of two, the screen will stay black. Moreover, since this is
not incorruptible, it is cumbersome to cancel it.
This commit is contained in:
Vincent Bernat 2014-09-14 18:55:57 +02:00
parent 863f117243
commit bd807d5f4c

View file

@ -8,18 +8,15 @@ case "$1" in
start)
xset s $(($timeout - $notify)) $notify
xset dpms $(($timeout * 2)) $(($timeout * 3)) $(($timeout * 4))
exec xss-lock -n "$me dim" -l $me lock
exec xss-lock -n "$me notify" -l $me lock
;;
dim)
echo "$(date --rfc-3339=seconds) $me: dim: start"
dim|notify)
echo "$(date --rfc-3339=seconds) $me: notify: start"
trap 'exit 0' TERM INT
trap "kill %% ; wait ; xbacklight -steps 1 -set $(xbacklight -get)" EXIT
min_brightness=1
fade_time=$(($notify * 1000 - 1000))
fade_steps=100
xbacklight -time $fade_time -steps $fade_steps -set $min_brightness &
wait
echo "$(date --rfc-3339=seconds) $me: dim: end"
trap "kill %% ; wait" EXIT
notify-send "Lock screen" -t $(($notify * 1000)) \
"Screen will be locked in 10 seconds..."
echo "$(date --rfc-3339=seconds) $me: notify: end"
sleep 2147483647 &
wait
;;