X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=shell%2Frc;h=dcb4cc16d5ddae0281b1b9bb81606c929d063bee;hb=a60026feb10e26fe211e62ca19787130a8b3b932;hp=aa15002c26c8b1c48f39cdc6ddcb8f30eef93420;hpb=17a3d6bf1dc5001799987d03b0e890f84a373ac9;p=config%2Fdotfiles.git diff --git a/shell/rc b/shell/rc index aa15002..dcb4cc1 100644 --- a/shell/rc +++ b/shell/rc @@ -39,11 +39,20 @@ 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_logout + fi } -timeout_setup_shell_lock() { +timeout_setup_shell_logout() { echo "Auto-logout after $timeout seconds (TTY detected)." TMOUT=$timeout echo @@ -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 @@ -92,14 +97,14 @@ case "$TERM" in esac else echo 'TERM=screen but neither $STY nor $TMUX found!' >&2 - timeout_setup_shell_lock + timeout_setup_shell_logout fi ;; *) case `tty` in /dev/tty[0-9]*) - timeout_setup_shell_lock + timeout_setup_shell_logout ;; esac ;;