]> ruderich.org/simon Gitweb - config/dotfiles.git/blobdiff - bin/xlockscreen
bin/xlockscreen: terminate running xautolock before starting new one
[config/dotfiles.git] / bin / xlockscreen
index 3cd3be7a9822860821fc5ea632dbf02290a3f2e2..01539b28b69c3e59d763b72ec62f6f9dac2565cf 100755 (executable)
@@ -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 &
@@ -89,9 +93,9 @@ elif test x"$1" = xlock; then
     elif installed xtrlock; then
         # Sleep is necessary to allow xtrlock to grab the keyboard input.
         sleep 1
-        xtrlock
+        exec xtrlock
     elif installed xlock; then
-        xlock
+        exec xlock
     else
         echo 'No screen locker found!'
         exit 1