# Shell configuration file.
-# Copyright (C) 2013 Simon Ruderich
+# Copyright (C) 2013-2014 Simon Ruderich
#
# This file is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
umask 077
fi
-# Disable flow control (^s ^q). I use GNU Screen/Tmux which also supports this
-# in a similar way (entering copy mode) and enabling flow control by accident
-# is annoying.
+# Disable flow control (^s and ^q). I use GNU Screen/Tmux which also supports
+# this in a similar way (entering copy mode) and enabling flow control by
+# accident is annoying.
if test -t 0; then
stty -ixon -ixoff
fi
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
;;
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
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
;;