From a92ce69d3960a0506527b6a8e884a46c171fd69b Mon Sep 17 00:00:00 2001 From: David Morgan Date: Sat, 12 Nov 2022 20:31:46 +0000 Subject: [PATCH] Allow auto-attaching tmux when connecting via ssh --- nix-conf/home/edrahil.nix | 4 ++++ nix-conf/home/includes/zsh.nix | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) 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