fix(@scripts): 🐛 adjust tmux session display formatting

Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
This commit is contained in:
Natalie 2026-05-17 08:00:13 -07:00
parent 167beadec6
commit c6927d4ae8
2 changed files with 24 additions and 13 deletions

View file

@ -786,22 +786,20 @@ cmd_resume() {
}
function fit(s, n) { return length(s) > n ? substr(s, 1, n-1) "…" : s }
# The trailing column (NF) is the optional display name set via
# `claude -n`. Wrap it in c_name when present.
function name_tag() {
if ($NF == "" || $2 == "tmux") return ""
return " " c_name "" $NF "" r
}
# `claude -n`. Promoted to column B: blank when absent.
function display() {
if ($2 == "tmux")
return c_tmux "▶ " r $3
if ($2 == "triage")
return prio_c($4) "P" $4 r " " stat_c($5) sprintf("%-15s", $5) r " " $6 " " c_dim "[" substr($3,1,8) "]" r name_tag()
if ($2 == "session")
return $4 " " c_dim "[" substr($3,1,8) "]" r name_tag()
if ($2 == "tmux") return c_tmux "▶ " r $3
if ($2 == "triage") return prio_c($4) "P" $4 r " " stat_c($5) sprintf("%-15s", $5) r " " $6 " " c_dim "[" substr($3,1,8) "]" r
if ($2 == "session") return $4 " " c_dim "[" substr($3,1,8) "]" r
return $3
}
function name_col() { return ($2=="tmux") ? "" : $NF }
{
printf "%s%-10s%s %s%-22s%s %s", c_host, $1, r, c_dim, fit(dir_label(), 22), r, display()
printf "%s%-10s%s %s%-22s%s %s%-22s%s %s",
c_host, $1, r,
c_name, fit(name_col(), 22), r,
c_dim, fit(dir_label(), 22), r,
display()
}
'
if [ ! -t 0 ] || [ ! -t 2 ]; then

View file

@ -23,8 +23,21 @@ setw -g aggressive-resize on
# Forward copy-mode selections to the OS clipboard via OSC 52, so mouse-drag
# or `y` in copy mode actually lands in the local terminal's clipboard even
# across ssh + tmux.
# across ssh + tmux. The terminal-features lines tell tmux to use OSC 52
# regardless of what the termcap entry advertises — necessary for many
# terminals (e.g. macOS Terminal.app, older iTerm2, kitty without overrides)
# where the clipboard capability isn't auto-detected.
set -g set-clipboard on
set -as terminal-features ',*:clipboard'
set -as terminal-overrides ',*:Ms=\E]52;c;%p2%s\007'
# Explicit copy-pipe bindings so mouse-drag-release and `y` in copy mode both
# stage the selection into tmux's buffer (which set-clipboard then OSC52s).
# Covers both default and vi copy-mode keytables.
bind-key -T copy-mode MouseDragEnd1Pane send-keys -X copy-pipe-no-clear
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-no-clear
bind-key -T copy-mode y send-keys -X copy-pipe-and-cancel
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel
# Keep window indexes contiguous when one closes; quiet the activity flag spam.
set -g renumber-windows on