From 4df4bc914ff7cee2784a5ef1e647eab5d2877a2a Mon Sep 17 00:00:00 2001 From: Marko Korhonen Date: Sat, 3 Sep 2022 12:31:38 +0300 Subject: [PATCH] Fix tmux autostart --- home/.config/zsh/05-misc.zsh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/home/.config/zsh/05-misc.zsh b/home/.config/zsh/05-misc.zsh index 9a31d42..68b0658 100644 --- a/home/.config/zsh/05-misc.zsh +++ b/home/.config/zsh/05-misc.zsh @@ -1,6 +1,10 @@ # Launch tmux if logging in over ssh if [[ -z "$TMUX" ]] && [ "$SSH_CONNECTION" != "" ]; then - exec tmux attach-session -t ssh_tmux || exec tmux new-session -s ssh_tmux + if tmux has-session &2>/dev/null; then + exec tmux attach-session -t ssh_tmux + else + exec tmux new-session -s ssh_tmux + fi fi # share history between running zsh instances