Skip to content

Commit f41a4e8

Browse files
feat(tmux): pillbox-styled session chooser with ADR
Add custom formatting to choose-tree (prefix+s) with: - Catppuccin Mocha colored pills (green=attached, blue=detached) - Window count with nerd font icon - Consistent styling with status bar Document the decision in ADR 0021, including the key constraint that tmux hardcodes the session name prefix and it cannot be styled or removed. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent dd8efca commit f41a4e8

3 files changed

Lines changed: 90 additions & 4 deletions

File tree

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# 21. Tmux Pillbox-Styled Session Chooser
2+
3+
Date: 2026-01-28
4+
5+
## Status
6+
7+
Accepted
8+
9+
## Context
10+
11+
The tmux status bar uses a consistent pillbox visual style with Catppuccin Mocha colors—rounded separators, colored backgrounds, and semantic color coding (green for active, blue for info, etc.). The built-in session chooser (`prefix+s`, which invokes `choose-tree -Zs`) uses plain default formatting, creating visual inconsistency.
12+
13+
Goals:
14+
15+
1. Apply pillbox styling to the session chooser for visual consistency
16+
2. Add semantic color coding (green for attached sessions, blue for others)
17+
3. Display useful metadata (window count) in a compact format
18+
19+
## Decision
20+
21+
Customize the `choose-tree` format using the `-F` flag with pillbox styling that matches the status bar.
22+
23+
### Implementation
24+
25+
```tmux
26+
set -g @_icon_windows "󱂬 " # nf-md-dock_window
27+
set -g @_chooser_format "\
28+
#{?session_attached,#[fg=#a6e3a1],#[fg=#89b4fa]}\
29+
#{@_pill_left}\
30+
#{?session_attached,#[fg=#11111b]#[bg=#a6e3a1],#[fg=#11111b]#[bg=#89b4fa]} \
31+
#{session_windows} #{@_icon_windows}\
32+
#{?session_attached,#[fg=#a6e3a1],#[fg=#89b4fa]}#[bg=default]\
33+
#{@_pill_right}#[default]"
34+
35+
bind-key s choose-tree -Zs -F "#{E:@_chooser_format}"
36+
```
37+
38+
### Key Constraint Discovered
39+
40+
The `choose-tree` command hardcodes a prefix before the custom format:
41+
42+
```
43+
(shortcut) indicator session-name: <custom format>
44+
```
45+
46+
The session name before the colon **cannot be removed, styled, or replaced**. The `-F` format only controls what appears after the colon. This limits alignment possibilities since session names vary in length.
47+
48+
### Alternatives Considered
49+
50+
1. **Include session path in format**
51+
52+
- Tried: `#{s|$HOME|~|:session_path}` with padding/truncation
53+
- Rejected: Path often duplicates session name; varying session name lengths before the colon prevent clean alignment regardless of padding
54+
55+
2. **Pad path to fixed width for alignment**
56+
57+
- Tried: `#{p-40:#{=/38/...:path}}` (40-char left-aligned field with truncation)
58+
- Rejected: Pills align relative to path column, but the column itself shifts based on session name length—the part we can't control
59+
60+
3. **Use fzf-based picker instead**
61+
62+
- `sesh` already provides this on `prefix+T` with full format control
63+
- Rejected for `prefix+s`: Keep the built-in for quick access; fzf picker serves different use case (fuzzy search, zoxide integration)
64+
65+
4. **Include activity/recency timestamp**
66+
- Available via `#{t:session_activity}`
67+
- Deferred: Adds clutter; may revisit if needed
68+
69+
## Consequences
70+
71+
### Positive
72+
73+
- **Visual consistency**: Session chooser now matches status bar styling
74+
- **Semantic coloring**: Green pills for attached sessions provide instant visual scanning
75+
- **Compact metadata**: Window count visible at a glance with icon
76+
- **Preserves functionality**: Built-in choose-tree behavior unchanged; just styled
77+
78+
### Negative
79+
80+
- **Limited control**: Cannot style or remove the hardcoded session name prefix
81+
- **Alignment impossible**: Varying session name lengths cause pills to appear at different horizontal positions
82+
- **Nerd font dependency**: Requires nerd fonts for pill separators and window icon
83+
84+
### Files
85+
86+
- `home/.tmux.conf`: Format definition and keybinding

doc/adr/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@
2020
- [18. switch-to-zoxide](0018-switch-to-zoxide.md)
2121
- [19. fish-plugin-drift-detection](0019-fish-plugin-drift-detection.md)
2222
- [20. tmux-prefix-c-space](0020-tmux-prefix-c-space.md)
23+
- [21. tmux-pillbox-styled-session-chooser](0021-tmux-pillbox-styled-session-chooser.md)

home/.tmux.conf

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,16 +184,15 @@ set -g status-right-length 100
184184
# ============================================================================
185185
# Session Chooser (prefix+s) - Pillbox styled
186186
# ============================================================================
187-
# Format: [windows pill] path (session name already shown by tmux)
188-
# Colors: green=attached, blue=detached, dim=path
187+
# Format: [windows pill] (session name shown by tmux prefix)
188+
# Colors: green=attached, blue=detached
189189
set -g @_icon_windows "󱂬 " # nf-md-dock_window
190190
set -g @_chooser_format "\
191191
#{?session_attached,#[fg=#a6e3a1],#[fg=#89b4fa]}\
192192
#{@_pill_left}\
193193
#{?session_attached,#[fg=#11111b]#[bg=#a6e3a1],#[fg=#11111b]#[bg=#89b4fa]} \
194194
#{session_windows} #{@_icon_windows}\
195195
#{?session_attached,#[fg=#a6e3a1],#[fg=#89b4fa]}#[bg=default]\
196-
#{@_pill_right} \
197-
#[fg=#6c7086]#{s|$HOME|~|:session_path}"
196+
#{@_pill_right}#[default]"
198197

199198
bind-key s choose-tree -Zs -F "#{E:@_chooser_format}"

0 commit comments

Comments
 (0)