From c9046ec26f63d43a21d37fdad4688ad1fd8c5279 Mon Sep 17 00:00:00 2001 From: mjallen18 Date: Tue, 10 Jun 2025 12:49:32 -0500 Subject: [PATCH] tmux --- share/home/defaults.nix | 38 +++++++++++++++++++++++++++++++++++++- share/home/shell.nix | 6 ++++++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/share/home/defaults.nix b/share/home/defaults.nix index 6839bbb..e7e33e1 100644 --- a/share/home/defaults.nix +++ b/share/home/defaults.nix @@ -43,7 +43,43 @@ java.enable = lib.mkDefault true; mangohud.enable = lib.mkDefault true; password-store.enable = true; - tmux.enable = true; + tmux = { + enable = true; + terminal = "screen-256color"; + sensibleOnTop = true; + focusEvents = true; + newSession = true; + plugins = with pkgs; [ + tmuxPlugins.cpu + { + plugin = tmuxPlugins.resurrect; + extraConfig = "set -g @resurrect-strategy-nvim 'session'"; + } + { + plugin = tmuxPlugins.continuum; + extraConfig = '' + set -g @continuum-restore 'on' + set -g @continuum-save-interval '60' # minutes + ''; + } + tmuxPlugins.better-mouse-mode + ]; + extraConfig = '' + set -g status-right '#[fg=black,bg=color15] #{cpu_percentage}  %H:%M ' + run-shell ${pkgs.tmuxPlugins.cpu}/share/tmux-plugins/cpu/cpu.tmux + set -g default-terminal "xterm-256color" + set -ga terminal-overrides ",*256col*:Tc" + set -ga terminal-overrides '*:Ss=\E[%p1%d q:Se=\E[ q' + set-environment -g COLORTERM "truecolor" + + # Mouse works as expected + set-option -g mouse on + # easy-to-remember split pane commands + bind | split-window -h -c "#{pane_current_path}" + bind - split-window -v -c "#{pane_current_path}" + bind c new-window -c "#{pane_current_path}" + ''; + }; }; services = { diff --git a/share/home/shell.nix b/share/home/shell.nix index 00e29a7..4188cec 100644 --- a/share/home/shell.nix +++ b/share/home/shell.nix @@ -19,5 +19,11 @@ in plugins = [ "git" ]; theme = "fishy"; }; + + initContent = '' + if command -v tmux &> /dev/null && [ -z "$TMUX" ]; then + tmux attach-session -t default || tmux new-session -s default + fi + ''; }; } \ No newline at end of file