lock: use xss-lock instead of xautolock

xss-lock features nice integration with standard X screensaver
feature which makes it easy to trigger it or to disable it. Moreover, it
also has some logind integration to lock screen before suspend.
This commit is contained in:
Vincent Bernat 2014-09-12 14:52:36 +02:00
parent 2c19d0021f
commit 097e076694
7 changed files with 48 additions and 37 deletions

View file

@ -1,3 +0,0 @@
#!/bin/sh
exec i3lock -e -n -i $HOME/.cache/awesome/current-wallpaper.png

View file

@ -1,8 +0,0 @@
#!/bin/sh
icon="$1"
exec notify-send "Lock screen" \
${icon:+-i $icon} \
-t 10000 \
"Lock screen will be started in 10 seconds..."

View file

@ -1,11 +0,0 @@
#!/bin/sh
icon="$1"
notify=$(dirname $(readlink -f "$0"))/notify-lock
locker=$(dirname $(readlink -f "$0"))/locker
exec xautolock \
-time 4 \
-locker "$locker" \
-notify 10 \
-notifier "$notify $icon"

37
bin/xss-lock Executable file
View file

@ -0,0 +1,37 @@
#!/bin/bash
me="$(readlink -f "$0")"
timeout=240
notify=5
case "$1" in
start)
xset s $timeout $notify
xset dpms $(($timeout * 2 + $notify)) $(($timeout * 3 + $notify)) $(($timeout * 4 + $notify))
exec xss-lock -n "$me dim" -l $me lock
;;
dim)
trap 'exit 0' TERM INT
trap "xbacklight -steps 1 -set $(xbacklight -get); kill %%" EXIT
min_brightness=0
fade_time=$(($notify * 1000))
fade_steps=20
fade_step_time=0.05
xbacklight -time $fade_time -steps $fade_steps -set $min_brightness
sleep 2147483647 &
wait
;;
lock)
i3lock_options="-e -i $HOME/.cache/awesome/current-wallpaper.png"
if [ -e /proc/self/fd/${XSS_SLEEP_LOCK_FD:--1} ]; then
trap 'kill %%' TERM INT
i3lock -n $i3lock_options {XSS_SLEEP_LOCK_FD}<&- &
exec {XSS_SLEEP_LOCK_FD}<&-
wait
else
trap 'kill %%' TERM INT
i3lock -n $i3lock_options &
wait
fi
;;
esac