X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=bin%2Fxlockscreen;h=11b8aecfff44f464a95959656ded0025e49de001;hb=e0a76c26f9164e070166fcc62e1c287cc1033eef;hp=88dbee5f1fcd58bcbcbd0967d1b137cea8f54f73;hpb=e022b5d244d6a1b99cca62a9fa569c360af0804d;p=config%2Fdotfiles.git diff --git a/bin/xlockscreen b/bin/xlockscreen index 88dbee5..11b8aec 100755 --- a/bin/xlockscreen +++ b/bin/xlockscreen @@ -58,6 +58,10 @@ if test x"$1" = xstart; then echo xscreensaver elif installed xautolock; 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 & @@ -82,14 +86,16 @@ elif test x"$1" = xlock; then 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