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)."
;;
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