Files
nixos-configs/hosts/pinwheel/modules/tmux/default.nix
T
Alexander Heldt ef585c9cf3 pinwheel: Make tmux pane borders visible
The borders used the terminal background color since the switch to
the grayscale palette, which hid them against the panes. Draw them in
the dim gray used for inactive window names instead.
2026-11-03 14:27:56 +01:00

100 lines
2.8 KiB
Nix

{ pkgs, config, ... }:
let
colors = config.lib.colors.terminal;
dim = builtins.elemAt colors.bright 0;
tmuxPanes = pkgs.writeShellApplication {
name = "tmux-panes";
runtimeInputs = [
pkgs.jq
pkgs.tmux
];
text = builtins.readFile ./panes.sh;
};
in
{
home-manager.users.alex = {
home.packages = [ tmuxPanes ];
programs.tmux = {
enable = true;
baseIndex = 1;
keyMode = "vi";
# Allow vi mode to be enabled instantly
escapeTime = 0;
plugins = [
pkgs.tmuxPlugins.sensible
{
plugin = pkgs.tmuxPlugins.resurrect;
extraConfig = ''
set -g @resurrect-capture-pane-contents 'on'
set -g @resurrect-processes '"~bin/claude->${tmuxPanes}/bin/tmux-panes restore claude" "~bin/emacs -nw->${tmuxPanes}/bin/tmux-panes restore emacs"'
set -g @resurrect-hook-post-save-all '${tmuxPanes}/bin/tmux-panes save'
'';
}
{
plugin = pkgs.tmuxPlugins.continuum;
extraConfig = ''
# Remove date/time etc. on the right side
set -g status-right ""
set -g @continuum-restore 'on'
set -g @continuum-save-interval '10'
'';
}
];
extraConfig = ''
set -g renumber-windows on
# https://old.reddit.com/r/tmux/comments/mesrci/tmux_2_doesnt_seem_to_use_256_colors/
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"
set-option -g allow-rename off
set -g set-clipboard on
# Status line colors
set -g status-fg '#${colors.foreground}'
set -g status-bg '#${colors.status}'
# Status window colors
set -g window-status-current-style bg='#${colors.status}',fg='#${colors.cursor}'
set -g window-status-style bg='#${colors.status}',fg='#${dim}'
set -g pane-border-style fg='#${dim}'
set -g pane-active-border-style fg='#${dim}'
set -g pane-border-lines "heavy"
# Remove accidental `suspend-client` triggers
unbind C-z
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
# Move panes shortcuts
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# Resize panes
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
# Move windows
bind -r Left swap-window -t -1 \; select-window -t -1
bind -r Right swap-window -t +1 \; select-window -t +1
'';
};
};
}