lock: avoid race condition with xbacklight

This commit is contained in:
Vincent Bernat 2014-09-13 20:33:17 +02:00
parent 8dc196e60d
commit 83c49d1222

View file

@ -13,11 +13,12 @@ case "$1" in
dim)
echo "$me: dim: start"
trap 'exit 0' TERM INT
trap "xbacklight -steps 1 -set $(xbacklight -get); kill %%" EXIT
trap "kill %% ; wait ; xbacklight -steps 1 -set $(xbacklight -get)" EXIT
min_brightness=0
fade_time=$(($notify * 800))
fade_time=$(($notify * 1000))
fade_steps=100
xbacklight -time $fade_time -steps $fade_steps -set $min_brightness
xbacklight -time $fade_time -steps $fade_steps -set $min_brightness &
wait
echo "$me: dim: end"
sleep 2147483647 &
wait