dotfiles/tmux

55 lines
1.7 KiB
Text
Raw Normal View History

# add C-a as primary prefix, keep C-b as secondary
2017-12-10 12:01:30 +00:00
set-option -g prefix C-a
set-option -g prefix2 C-b
2017-12-10 12:01:30 +00:00
bind-key C-a send-prefix
2017-12-10 12:19:05 +00:00
# start with window 1 (instead of 0)
set -g base-index 1
# also start with 1 for window panes
setw -g pane-base-index 1
2017-12-10 12:19:05 +00:00
# renumber windows sequentially after closing any of them
set -g renumber-windows on
# don't detach when closing a window if other windows remain
set -g detach-on-destroy off
2017-12-10 12:01:30 +00:00
# reload config file (change file location to your the tmux.conf you want to use)
unbind r
2017-12-10 12:01:30 +00:00
bind r source-file ~/.tmux.conf
# Enable mouse mode (tmux 2.1 and above)
set -g mouse on
2017-12-10 12:19:05 +00:00
# Track focus events
set-option -g focus-events on
2017-12-10 12:19:05 +00:00
# don't rename windows automatically
set-option -g allow-rename off
2017-12-11 16:19:47 +00:00
# Set terminal
set -g default-terminal "$TERM"
2026-03-22 18:00:10 +00:00
# Allow OSC 8 links
set -ga terminal-features "*:hyperlinks"
# Set status bar length
set -g status-left-length 40
set -g status-right-length 60
# Center the window list
set -g status-justify centre
Follow light/dark appearance in the tmux status bar The status bar was five hardcoded tangere-dark colours, so in light mode the pale #fdfdd9 text landed on a white background and became unreadable. That was the real reason Auto appearance "never worked with the terminal setup" — ghostty was switching correctly all along. Split the colours into tmux-light.conf and tmux-dark.conf. The dark file is extracted byte-exact from the previous config; the light file is the same layout with each colour swapped for the tangere-light palette entry at the same index, so roles are preserved (text on an accent uses the theme background, which inverts from #1a2938 to #fdfdfa). tmux 3.6+ learns the terminal's theme over OSC 2031, so this keys off the appearance change itself rather than a schedule, and behaves identically whether that came from Auto at sunrise/sunset or a manual toggle. Three hooks: the two theme hooks react to a change, and client-attached covers a client attaching mid-way, since those two only fire on a change. Sourcing is idempotent so the overlap is harmless. This replaces the dark-mode-notify launchd agent removed in 59d5622, which could not have worked: it re-sourced .zshrc inside each shell, but the status bar belongs to the tmux server. Verified by round trip: flipping to Light switched #{client_theme} and applied the light palette, and returning to Dark restored it. A running nvim does not follow a live change (docs: the TUI sets 'background' on startup); noted in the README. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-09 12:38:16 +01:00
# Status bar colours live in ~/.tmux-light.conf and ~/.tmux-dark.conf. tmux
# learns the terminal's theme over OSC 2031, so this reacts to the appearance
# change itself, whether that came from Auto at sunrise/sunset or a manual
# toggle, since nothing here knows why it changed.
set-hook -g client-light-theme 'source-file ~/.tmux-light.conf'
set-hook -g client-dark-theme 'source-file ~/.tmux-dark.conf'
Follow light/dark appearance in the tmux status bar The status bar was five hardcoded tangere-dark colours, so in light mode the pale #fdfdd9 text landed on a white background and became unreadable. That was the real reason Auto appearance "never worked with the terminal setup" — ghostty was switching correctly all along. Split the colours into tmux-light.conf and tmux-dark.conf. The dark file is extracted byte-exact from the previous config; the light file is the same layout with each colour swapped for the tangere-light palette entry at the same index, so roles are preserved (text on an accent uses the theme background, which inverts from #1a2938 to #fdfdfa). tmux 3.6+ learns the terminal's theme over OSC 2031, so this keys off the appearance change itself rather than a schedule, and behaves identically whether that came from Auto at sunrise/sunset or a manual toggle. Three hooks: the two theme hooks react to a change, and client-attached covers a client attaching mid-way, since those two only fire on a change. Sourcing is idempotent so the overlap is harmless. This replaces the dark-mode-notify launchd agent removed in 59d5622, which could not have worked: it re-sourced .zshrc inside each shell, but the status bar belongs to the tmux server. Verified by round trip: flipping to Light switched #{client_theme} and applied the light palette, and returning to Dark restored it. A running nvim does not follow a live change (docs: the TUI sets 'background' on startup); noted in the README. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-09 12:38:16 +01:00
# Those hooks only fire on a change, so also pick the right palette whenever a
# client attaches. Sourcing is idempotent, so the overlap is harmless.
set-hook -g client-attached 'if -F "#{==:#{client_theme},light}" "source-file ~/.tmux-light.conf" "source-file ~/.tmux-dark.conf"'
Follow light/dark appearance in the tmux status bar The status bar was five hardcoded tangere-dark colours, so in light mode the pale #fdfdd9 text landed on a white background and became unreadable. That was the real reason Auto appearance "never worked with the terminal setup" — ghostty was switching correctly all along. Split the colours into tmux-light.conf and tmux-dark.conf. The dark file is extracted byte-exact from the previous config; the light file is the same layout with each colour swapped for the tangere-light palette entry at the same index, so roles are preserved (text on an accent uses the theme background, which inverts from #1a2938 to #fdfdfa). tmux 3.6+ learns the terminal's theme over OSC 2031, so this keys off the appearance change itself rather than a schedule, and behaves identically whether that came from Auto at sunrise/sunset or a manual toggle. Three hooks: the two theme hooks react to a change, and client-attached covers a client attaching mid-way, since those two only fire on a change. Sourcing is idempotent so the overlap is harmless. This replaces the dark-mode-notify launchd agent removed in 59d5622, which could not have worked: it re-sourced .zshrc inside each shell, but the status bar belongs to the tmux server. Verified by round trip: flipping to Light switched #{client_theme} and applied the light palette, and returning to Dark restored it. A running nvim does not follow a live change (docs: the TUI sets 'background' on startup); noted in the README. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-09 12:38:16 +01:00
# Default before any client has attached and reported a theme.
source-file ~/.tmux-dark.conf