From: Simon Ruderich Date: Wed, 20 Nov 2013 21:54:42 +0000 (+0100) Subject: shell/rc: Use shell timeout in Tmux if vlock wasn't found. X-Git-Url: https://ruderich.org/simon/gitweb/?a=commitdiff_plain;h=9b975c15a2b8ab40b76e4f3922b43df1ec2c149c;p=config%2Fdotfiles.git shell/rc: Use shell timeout in Tmux if vlock wasn't found. --- diff --git a/shell/rc b/shell/rc index aa15002..c3cfade 100644 --- 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