xscreensaver >/dev/null &
echo xscreensaver
elif installed xautolock; then
- if installed "$lock_bin"; then
+ if installed "$lock_binary"; then
+ # Terminate a running xautolock because we might have to replace
+ # its timeout and other settings with our values.
+ pkill -u "$USER" xautolock || true
+
xautolock -secure -time "$lock_time_minutes" \
-locker "$lock_binary" \
>/dev/null &
echo xautolock
else
- echo "Locker '$lock_bin' not installed. Auto lock won't work!"
+ echo "Locker '$lock_binary' not installed. Auto lock won't work!"
exit 1
fi
else
xscreensaver-command -time >/dev/null 2>&1 || xscreensaver &
# It can take a while for xscreensaver to start, wait until it's
- # ready.
+ # ready. a || b && c behaves like (a || b) && c.
while :; do
xscreensaver-command -lock || test $? -ne 255 && break
done
elif installed xtrlock; then
# Sleep is necessary to allow xtrlock to grab the keyboard input.
sleep 1
- xtrlock
+ exec xtrlock
+ elif installed xlock; then
+ exec xlock
else
echo 'No screen locker found!'
exit 1