1
0
mirror of https://github.com/bertptrs/vimconfig.git synced 2025-12-25 20:40:32 +01:00

Start tmux also for alacritty.

This commit is contained in:
2019-04-10 12:20:32 +02:00
parent 9f0fafeb08
commit 8a368e3d3b

View File

@@ -1,5 +1,16 @@
# If connected over SSH and not already in tmux, start tmux.
if [[ -o interactive ]] && [[ -n $SSH_TTY ]] && [[ -z $TMUX ]] && type tmux &> /dev/null; then
# Check if we want a multiplexer.
#
# We want one if we are either:
# - connected over SSH (for security), or
# - using alacritty, since it doesn't have tabs.
function want_multiplexer() {
[[ $TERM == "alacritty" ]] || \
[[ -n $SSH_TTY ]]
}
# If we want a multiplexer and not already in tmux, start tmux.
if [[ -o interactive ]] && want_multiplexer && [[ -z $TMUX ]] && type tmux &> /dev/null; then
if tmux has-session &> /dev/null; then
tmux attach
else
@@ -8,6 +19,8 @@ if [[ -o interactive ]] && [[ -n $SSH_TTY ]] && [[ -z $TMUX ]] && type tmux &> /
exit $?
fi
unset -f want_multiplexer
# Check for service-managed keyring
if [[ -z $SSH_AUTH_SOCK ]] && [[ -S $XDG_RUNTIME_DIR/ssh-agent.socket ]]; then
export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket"