about summary refs log tree commit diff stats
path: root/nix-conf
diff options
context:
space:
mode:
authorDavid Morgan <djm_uk@protonmail.com>2022-11-12 20:31:46 +0000
committerDavid Morgan <djm_uk@protonmail.com>2022-11-12 20:33:25 +0000
commita92ce69d3960a0506527b6a8e884a46c171fd69b (patch)
tree877de3838acfb46b45624e01d732c33784080a12 /nix-conf
parentca4e381eb7a5100a57219c37cd1a3268d5031ed3 (diff)
downloaddotfiles-a92ce69d3960a0506527b6a8e884a46c171fd69b.tar.gz
Allow auto-attaching tmux when connecting via ssh
Diffstat (limited to 'nix-conf')
-rw-r--r--nix-conf/home/edrahil.nix4
-rw-r--r--nix-conf/home/includes/zsh.nix2
2 files changed, 5 insertions, 1 deletions
diff --git a/nix-conf/home/edrahil.nix b/nix-conf/home/edrahil.nix
index b871056..3e39dd3 100644
--- a/nix-conf/home/edrahil.nix
+++ b/nix-conf/home/edrahil.nix
@@ -12,6 +12,10 @@
   home.username = "djm";
   home.homeDirectory = "/home/djm";
 
+  home.sessionVariables = {
+    TMUX_AUTO_ATTACH=1;
+  };
+
   # This value determines the Home Manager release that your
   # configuration is compatible with. This helps avoid breakage
   # when a new Home Manager release introduces backwards
diff --git a/nix-conf/home/includes/zsh.nix b/nix-conf/home/includes/zsh.nix
index f08b299..95a8b1f 100644
--- a/nix-conf/home/includes/zsh.nix
+++ b/nix-conf/home/includes/zsh.nix
@@ -75,7 +75,7 @@
 
     initExtra = ''
       # Taken from prezto tmux plugin
-      if [[ -z "$TMUX" && -z "$EMACS" && -z "$VIM" && -z "$INSIDE_EMACS" && -z "$SSH_TTY" ]]; then
+      if [[ -z "$TMUX" && -z "$EMACS" && -z "$VIM" && -z "$INSIDE_EMACS" && (-z "$SSH_TTY" || -n "$TMUX_AUTO_ATTACH") ]]; then
         tmux start-server
 
         if ! tmux has-session 2> /dev/null; then