]> ruderich.org/simon Gitweb - config/dotfiles.git/commitdiff
bin/xlockscreen: fix xscreensaver-command -lock loop
authorSimon Ruderich <simon@ruderich.org>
Sun, 23 Aug 2015 09:46:08 +0000 (11:46 +0200)
committerSimon Ruderich <simon@ruderich.org>
Sun, 23 Aug 2015 09:46:08 +0000 (11:46 +0200)
set -e terminated the script after the first -lock if it failed, never
entering the loop.

bin/xlockscreen

index 1bac3a19aadba22209858a50f97e02f2ed688331..88c4a48874d324830147137bbb4e94dad73f0c1c 100755 (executable)
@@ -78,11 +78,10 @@ elif test x"$1" = xlock; then
         # ensures xscreensaver is available for the current X session.
         xscreensaver-command -time >/dev/null 2>&1 || xscreensaver &
 
-        xscreensaver-command -lock
         # It can take a while for xscreensaver to start, wait until it's
         # ready.
-        while test $? -eq 255; do
-            xscreensaver-command -lock
+        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.