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) start)
xset s $(($timeout - $notify)) $notify xset s $(($timeout - $notify)) $notify
xset dpms $(($timeout * 2)) $(($timeout * 3)) $(($timeout * 4)) 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) dim|notify)
echo "$(date --rfc-3339=seconds) $me: dim: start" echo "$(date --rfc-3339=seconds) $me: notify: start"
trap 'exit 0' TERM INT trap 'exit 0' TERM INT
trap "kill %% ; wait ; xbacklight -steps 1 -set $(xbacklight -get)" EXIT trap "kill %% ; wait" EXIT
min_brightness=1 notify-send "Lock screen" -t $(($notify * 1000)) \
fade_time=$(($notify * 1000 - 1000)) "Screen will be locked in 10 seconds..."
fade_steps=100 echo "$(date --rfc-3339=seconds) $me: notify: end"
xbacklight -time $fade_time -steps $fade_steps -set $min_brightness &
wait
echo "$(date --rfc-3339=seconds) $me: dim: end"
sleep 2147483647 & sleep 2147483647 &
wait wait
;; ;;