diff --git a/dot_tmux.conf b/dot_tmux.conf index 906a68f..d92ea40 100644 --- a/dot_tmux.conf +++ b/dot_tmux.conf @@ -66,12 +66,13 @@ 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]}] ' -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