zsh:zprofile: Attach to tmux only when it exists

This commit is contained in:
2021-09-08 13:39:10 +02:00
parent 03835c5d8d
commit 8c7c37d65b

View File

@@ -104,7 +104,9 @@ if command -v startx &>/dev/null && [[ -z $DISPLAY && $XDG_VTNR -eq 1 ]]; then
fi
# Attach to tmux session if connected over ssh and not already attached
if [[ (-n $SSH_CLIENT || -n $SSH_TTY || -n $SSH_CONNECTION) && -z $TMUX ]]; then
if (( $+commands[tmux] )) &&
[[ (-n $SSH_CLIENT || -n $SSH_TTY || -n $SSH_CONNECTION) && -z $TMUX ]]
then
num_sessions="$(tmux list-sessions 2>/dev/null | wc -l)"
if (( ! num_sessions )); then