about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorDavid Morgan <djm_uk@protonmail.com>2022-11-30 16:12:56 +0000
committerDavid Morgan <djm_uk@protonmail.com>2022-11-30 16:12:56 +0000
commit293b3f86744832fdc577236fa88621fa9232724f (patch)
tree62cb27da79a7ed8f65564e3267c7bf1895cf5095
parent5974c91359e181a906b7ede81f1e29530fa404af (diff)
downloaddotfiles-293b3f86744832fdc577236fa88621fa9232724f.tar.gz
Don't dettach other tmux sessions when connecting via ssh
-rw-r--r--nix-conf/home/includes/zsh.nix8
1 files changed, 6 insertions, 2 deletions
diff --git a/nix-conf/home/includes/zsh.nix b/nix-conf/home/includes/zsh.nix
index 7fdb666..c9d8926 100644
--- a/nix-conf/home/includes/zsh.nix
+++ b/nix-conf/home/includes/zsh.nix
@@ -81,7 +81,7 @@
     };
 
     initExtra = ''
-      # Taken from prezto tmux plugin
+      # Based on prezto tmux plugin
       if [[ -z "$TMUX" && -z "$EMACS" && -z "$VIM" && -z "$INSIDE_EMACS" && (-z "$SSH_TTY" || -n "$TMUX_AUTO_ATTACH") ]]; then
         tmux start-server
 
@@ -89,7 +89,11 @@
           tmux new-session -d -s "0" \; set-option -t "0" destroy-unattached off &> /dev/null
         fi
 
-        exec tmux -u attach-session -d
+        if [[ -n "$SSH_TTY" ]]; then
+          exec tmux -u attach-session
+        else
+          exec tmux -u attach-session -d
+        fi
       fi
 
       export FZF_DEFAULT_COMMAND='rg --files --no-ignore --hidden --follow -g "!{.git,node_modules}/*" 2> /dev/null'