From 05947fb86a2f6649ad7cc717eb994cf05c765b24 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 16 Jul 2026 05:03:47 +0000 Subject: [PATCH 1/2] Harden tmux @machine_name caching for status bar Prefer the first line of ~/.name, fall back to hostname -s, and strip CR/LF so a trailing newline from cat does not distort status-right. Co-authored-by: Huy Pham --- dot_tmux.conf | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dot_tmux.conf b/dot_tmux.conf index 906a68f..ccef8c9 100644 --- a/dot_tmux.conf +++ b/dot_tmux.conf @@ -66,8 +66,9 @@ set -sg escape-time 0 # display pane numbers for longer set -g display-panes-time 2000 -# Machine name for status bar (resolved once when config is sourced) -run-shell 'tmux set -g @machine_name "$(if [ -f "$HOME/.name" ]; then cat "$HOME/.name"; else hostname -s; fi)"' +# Machine name for status bar (resolved once when config is sourced). +# head -n1 + strip CR/LF so a trailing newline from ~/.name does not break the bar. +run-shell 'name=; if [ -r "$HOME/.name" ]; then name=$(head -n1 "$HOME/.name"); fi; name=${name:-$(hostname -s)}; name=$(printf %s "$name" | tr -d "\r\n"); tmux set -g @machine_name "$name"' set -g status-left-length 20 set -g status-left '#{?pane_input_off,#[fg=#ed8796],#[fg=#f5a97f]}[#[fg=#f5a97f]#S:#I.#P#{?pane_input_off,#[fg=#ed8796],#[fg=#f5a97f]}] ' From a577bc736791d921677b658cb1e6c3c04585e120 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 16 Jul 2026 05:04:05 +0000 Subject: [PATCH 2/2] Clarify tmux status-right prefix color conditional MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use an explicit true/false fg in #{?client_prefix,…} instead of setting peach then optionally overriding, so prefix-active styling is obvious. Co-authored-by: Huy Pham --- dot_tmux.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dot_tmux.conf b/dot_tmux.conf index ccef8c9..d92ea40 100644 --- a/dot_tmux.conf +++ b/dot_tmux.conf @@ -72,7 +72,7 @@ run-shell 'name=; if [ -r "$HOME/.name" ]; then name=$(head -n1 "$HOME/.name"); set -g status-left-length 20 set -g status-left '#{?pane_input_off,#[fg=#ed8796],#[fg=#f5a97f]}[#[fg=#f5a97f]#S:#I.#P#{?pane_input_off,#[fg=#ed8796],#[fg=#f5a97f]}] ' -set -g status-right '#[fg=#f5a97f]#{?client_prefix,#[fg=#ed8796],} %d %b %Y #[fg=#8aadf4]%I:%M %p #[fg=#a5adcb]#{@machine_name}' +set -g status-right '#{?client_prefix,#[fg=#ed8796],#[fg=#f5a97f]}%d %b %Y #[fg=#8aadf4]%I:%M %p #[fg=#a5adcb]#{@machine_name}' # increase scrollback lines set -g history-limit 65536