Only start tmux if there is no client currently attached

This commit is contained in:
Kevin Cotugno 2024-02-16 13:15:27 -07:00
parent 7ef46e75eb
commit 5d230abfd7

5
.zshrc
View File

@ -17,7 +17,10 @@ if [[ -f "$oh_my_zsh/oh-my-zsh.sh" ]]; then
)
if [[ $(command -v tmux) ]]; then
if [[ ! -v "ZSH_TMUX_AUTOSTART" ]]; then export ZSH_TMUX_AUTOSTART=true; fi
# Only start/attach if no existing session with client.
if [[ (( $(tmux list-sessions -F "#{session_attached}" 2>/dev/null || echo 0) = 0 )) && ! -v "ZSH_TMUX_AUTOSTART" ]]; then
export ZSH_TMUX_AUTOSTART=true
fi
plugins+=(tmux)
fi