From 2c0d413da76c33e2fed12493c8b978fd94439fd8 Mon Sep 17 00:00:00 2001 From: TrudeEH Date: Sun, 13 Oct 2024 19:39:23 +0100 Subject: [PATCH] Set TMUX shell based on condition --- nix/home.nix | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/nix/home.nix b/nix/home.nix index 165b73dd..45e8132e 100644 --- a/nix/home.nix +++ b/nix/home.nix @@ -533,6 +533,7 @@ in plugins = with pkgs; [ tmuxPlugins.cpu ]; prefix = "C-s"; terminal = "tmux-256color"; + shell = if isLinux then "${pkgs.zsh}/bin/zsh" else "/bin/zsh"; extraConfig = '' bind-key C command-prompt -p "Name of new window: " "new-window -n '%%'" @@ -641,6 +642,13 @@ in set -o vi export EDITOR="nvim"; export PS1="\n[\[\e[37m\]\u\[\e[0m\]@\[\e[37;2m\]\h\[\e[0m\]] \[\e[1m\]\w \[\e[0;2m\]J:\[\e[0m\]\j\n\$ "; + + if [[ -z $TMUX ]]; then + tmux attach + if [[ $? == 1 ]]; then + tmux new -s main + fi + fi ''; }; @@ -672,6 +680,13 @@ in set -o vi export EDITOR="nvim"; + + if [[ -z $TMUX ]]; then + tmux attach + if [[ $? == 1 ]]; then + tmux new -s main + fi + fi ''; };