]> ruderich.org/simon Gitweb - config/dotfiles.git/blobdiff - shell/rc
shell/rc: Use shell timeout in Tmux if vlock wasn't found.
[config/dotfiles.git] / shell / rc
index aa15002c26c8b1c48f39cdc6ddcb8f30eef93420..c3cfade3fe47375778746c16d279912d2e4d159e 100644 (file)
--- a/shell/rc
+++ b/shell/rc
@@ -39,9 +39,18 @@ timeout_setup_screen_lock() {
     echo
 }
 timeout_setup_tmux_lock() {
-    echo "Locking Tmux after $timeout seconds (TTY detected)."
-    tmux set-option lock-after-time $timeout
-    echo
+    if type vlock >/dev/null; then
+        echo "Locking Tmux after $timeout seconds (TTY detected)."
+        tmux set-option lock-after-time $timeout
+        echo
+
+    else
+        echo "vlock not found, locking won't work in Tmux!" >&2
+        echo "Falling back to shell timeout." >&2
+        echo
+
+        timeout_setup_shell_lock
+    fi
 }
 timeout_setup_shell_lock() {
     echo "Auto-logout after $timeout seconds (TTY detected)."
@@ -65,10 +74,6 @@ case "$TERM" in
                     ;;
             esac
         elif test -n "$TMUX"; then
-            if ! type vlock >/dev/null; then
-                echo "vlock not found, locking won't work in Tmux!" >&2
-            fi
-
             case "`tmux display -p '#{client_tty}'`" in
                 /dev/tty[0-9]*)
                     timeout_setup_tmux_lock