From da38ac3d80ef53f00918118b1574160a832e863e Mon Sep 17 00:00:00 2001 From: Gregory Pakosz Date: Sat, 17 Oct 2020 22:23:48 +0200 Subject: [PATCH] improved status line rendering, fixes #419 - non current windows now use separators when they're enabled - fixed style for last window, window with activity and window with bell --- .tmux.conf | 82 ++++++++++++++++++++++++++++++++++-------------- .tmux.conf.local | 10 +++--- 2 files changed, 64 insertions(+), 28 deletions(-) diff --git a/.tmux.conf b/.tmux.conf index 6a0e6efdb..29e1b93ed 100644 --- a/.tmux.conf +++ b/.tmux.conf @@ -901,10 +901,57 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # tmux_conf_theme_window_status_current_bg=${tmux_conf_theme_window_status_current_bg:-$tmux_conf_theme_colour_4} # tmux_conf_theme_window_status_current_attr=${tmux_conf_theme_window_status_current_attr:-bold} # tmux_conf_theme_window_status_current_format=${tmux_conf_theme_window_status_current_format:-#I #W} +# +# tmux_conf_theme_window_status_activity_fg=${tmux_conf_theme_window_status_activity_fg:-default} +# tmux_conf_theme_window_status_activity_bg=${tmux_conf_theme_window_status_activity_bg:-default} +# tmux_conf_theme_window_status_activity_attr=${tmux_conf_theme_window_status_activity_attr:-underscore} +# +# tmux_conf_theme_window_status_bell_fg=${tmux_conf_theme_window_status_bell_fg:-$tmux_conf_theme_colour_5} +# tmux_conf_theme_window_status_bell_bg=${tmux_conf_theme_window_status_bell_bg:-default} +# tmux_conf_theme_window_status_bell_attr=${tmux_conf_theme_window_status_bell_attr:-blink,bold} +# +# tmux_conf_theme_window_status_last_fg=${tmux_conf_theme_window_status_last_fg:-$tmux_conf_theme_colour_4} +# tmux_conf_theme_window_status_last_bg=${tmux_conf_theme_window_status_last_bg:-default} +# tmux_conf_theme_window_status_last_attr=${tmux_conf_theme_window_status_last_attr:-none} +# +# if [ x"$tmux_conf_theme_status_bg" = x"$tmux_conf_theme_window_status_bg" ]; then +# spacer='' +# spacer_current=' ' +# else +# spacer=' ' +# spacer_current=' ' +# fi +# if [ x"$tmux_conf_theme_status_bg" = x"$tmux_conf_theme_window_status_last_bg" ]; then +# spacer_last='' +# else +# spacer_last=' ' +# fi +# if [ x"$tmux_conf_theme_status_bg" = x"$tmux_conf_theme_window_status_activity_bg" ]; then +# spacer_activity='' +# else +# spacer_activity=' ' +# fi +# if [ x"$tmux_conf_theme_status_bg" = x"$tmux_conf_theme_window_status_bell_bg" ]; then +# spacer_bell='' +# else +# spacer_bell=' ' +# fi # if [ x"$(tmux show -g -v status-justify)" = x"right" ]; then -# tmux_conf_theme_window_status_current_format="#[fg=$tmux_conf_theme_window_status_current_bg,bg=$tmux_conf_theme_status_bg,none]$tmux_conf_theme_right_separator_main#[fg=$tmux_conf_theme_window_status_current_fg,bg=$tmux_conf_theme_window_status_current_bg,$tmux_conf_theme_window_status_current_attr] $tmux_conf_theme_window_status_current_format #[fg=$tmux_conf_theme_window_status_current_bg,bg=$tmux_conf_theme_status_bg,none,reverse]$tmux_conf_theme_right_separator_main" +# if [ -z "$tmux_conf_theme_right_separator_main" ]; then +# window_status_separator=' ' +# else +# window_status_separator='' +# fi +# tmux_conf_theme_window_status_format="#[fg=$tmux_conf_theme_window_status_bg,bg=$tmux_conf_theme_status_bg,none]#{?window_last_flag,$(printf "$tmux_conf_theme_window_status_last_bg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf "$tmux_conf_theme_window_status_activity_bg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf "$tmux_conf_theme_window_status_bell_bg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}$tmux_conf_theme_right_separator_main#[fg=$tmux_conf_theme_window_status_fg,bg=$tmux_conf_theme_window_status_bg,$tmux_conf_theme_window_status_attr]#{?window_last_flag,$(printf "$tmux_conf_theme_window_status_last_fg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_last_flag,$(printf "$tmux_conf_theme_window_status_last_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}$(printf "$tmux_conf_theme_window_status_last_attr" | perl -n -e 'print "#[none]" if !/default/ ; s/([a-z]+),?/#{?window_last_flag,#[\1],}/g; print if !/default/')#{?window_activity_flag,$(printf "$tmux_conf_theme_window_status_activity_fg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf "$tmux_conf_theme_window_status_activity_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}$(printf "$tmux_conf_theme_window_status_activity_attr" | perl -n -e 'print "#[none]" if !/default/ ; s/([a-z]+),?/#{?window_activity_flag,#[\1],}/g; print if !/default/')#{?window_bell_flag,$(printf "$tmux_conf_theme_window_status_bell_fg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf "$tmux_conf_theme_window_status_bell_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}$(printf "$tmux_conf_theme_window_status_bell_attr" | perl -n -e 'print "#[none]" if !/default/ ; s/([a-z]+),?/#{?window_bell_flag,#[\1],}/g; print if !/default/')#{?window_bell_flag,$spacer_bell,#{?window_activity_flag,$spacer_activity,#{?window_last_flag,$spacer_last,$spacer}}}$tmux_conf_theme_window_status_format#{?window_bell_flag,$spacer_bell,#{?window_activity_flag,$spacer_activity,#{?window_last_flag,$spacer_last,$spacer}}}#[fg=$tmux_conf_theme_status_bg,bg=$tmux_conf_theme_window_status_bg]#{?window_last_flag,$(printf "$tmux_conf_theme_window_status_last_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf "$tmux_conf_theme_window_status_activity_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf "$tmux_conf_theme_window_status_bell_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#[none]$tmux_conf_theme_right_separator_main" +# tmux_conf_theme_window_status_current_format="#[fg=$tmux_conf_theme_window_status_current_bg,bg=$tmux_conf_theme_status_bg,none]$tmux_conf_theme_right_separator_main#[fg=$tmux_conf_theme_window_status_current_fg,bg=$tmux_conf_theme_window_status_current_bg,$tmux_conf_theme_window_status_current_attr]$spacer_current$tmux_conf_theme_window_status_current_format$spacer_current#[fg=$tmux_conf_theme_status_bg,bg=$tmux_conf_theme_window_status_current_bg,none]$tmux_conf_theme_right_separator_main" # else -# tmux_conf_theme_window_status_current_format="#[fg=$tmux_conf_theme_window_status_current_bg,bg=$tmux_conf_theme_status_bg,none,reverse]$tmux_conf_theme_left_separator_main#[noreverse]#[fg=$tmux_conf_theme_window_status_current_fg,bg=$tmux_conf_theme_window_status_current_bg,$tmux_conf_theme_window_status_current_attr] $tmux_conf_theme_window_status_current_format #[fg=$tmux_conf_theme_window_status_current_bg,bg=$tmux_conf_theme_status_bg]$tmux_conf_theme_left_separator_main" +# if [ -z "$tmux_conf_theme_left_separator_main" ]; then +# window_status_separator=' ' +# else +# window_status_separator='' +# fi +# tmux_conf_theme_window_status_format="#[fg=$tmux_conf_theme_status_bg,bg=$tmux_conf_theme_window_status_bg,none]#{?window_last_flag,$(printf "$tmux_conf_theme_window_status_last_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf "$tmux_conf_theme_window_status_activity_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf "$tmux_conf_theme_window_status_bell_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}$tmux_conf_theme_left_separator_main#[fg=$tmux_conf_theme_window_status_fg,bg=$tmux_conf_theme_window_status_bg,$tmux_conf_theme_window_status_attr]#{?window_last_flag,$(printf "$tmux_conf_theme_window_status_last_fg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_last_flag,$(printf "$tmux_conf_theme_window_status_last_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}$(printf "$tmux_conf_theme_window_status_last_attr" | perl -n -e 'print "#[none]" if !/default/ ; s/([a-z]+),?/#{?window_last_flag,#[\1],}/g; print if !/default/')#{?window_activity_flag,$(printf "$tmux_conf_theme_window_status_activity_fg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf "$tmux_conf_theme_window_status_activity_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}$(printf "$tmux_conf_theme_window_status_activity_attr" | perl -n -e 'print "#[none]" if !/default/ ; s/([a-z]+),?/#{?window_activity_flag,#[\1],}/g; print if !/default/')#{?window_bell_flag,$(printf "$tmux_conf_theme_window_status_bell_fg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf "$tmux_conf_theme_window_status_bell_bg" | perl -n -e "s/.+/#[bg=$&]/; print if !/default/"),}$(printf "$tmux_conf_theme_window_status_bell_attr" | perl -n -e 'print "#[none]" if /!default/ ; s/([a-z]+),?/#{?window_bell_flag,#[\1],}/g; print if !/default/')#{?window_bell_flag,$spacer_bell,#{?window_activity_flag,$spacer_activity,#{?window_last_flag,$spacer_last,$spacer}}}$tmux_conf_theme_window_status_format#{?window_bell_flag,$spacer_bell,#{?window_activity_flag,$spacer_activity,#{?window_last_flag,$spacer_last,$spacer}}}#[fg=$tmux_conf_theme_window_status_bg,bg=$tmux_conf_theme_status_bg]#{?window_last_flag,$(printf "$tmux_conf_theme_window_status_last_bg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_activity_flag,$(printf "$tmux_conf_theme_window_status_activity_bg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#{?window_bell_flag,$(printf "$tmux_conf_theme_window_status_bell_bg" | perl -n -e "s/.+/#[fg=$&]/; print if !/default/"),}#[none]$tmux_conf_theme_left_separator_main" +# tmux_conf_theme_window_status_current_format="#[fg=$tmux_conf_theme_status_bg,bg=$tmux_conf_theme_window_status_current_bg,none]$tmux_conf_theme_left_separator_main#[fg=$tmux_conf_theme_window_status_current_fg,bg=$tmux_conf_theme_window_status_current_bg,$tmux_conf_theme_window_status_current_attr]$spacer_current$tmux_conf_theme_window_status_current_format$spacer_current#[fg=$tmux_conf_theme_window_status_current_bg,bg=$tmux_conf_theme_status_bg]$tmux_conf_theme_left_separator_main" # fi # # tmux_conf_theme_window_status_format=$(echo "$tmux_conf_theme_window_status_format" | sed \ @@ -922,26 +969,14 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # -e 's%#{username_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _username #{pane_tty} true #D)%g' \ # -e 's%#{hostname_ssh}%#(cut -c3- ~/.tmux.conf | sh -s _hostname #{pane_tty} true #h #D)%g') # -# tmux_conf_theme_window_status_activity_fg=${tmux_conf_theme_window_status_activity_fg:-default} -# tmux_conf_theme_window_status_activity_bg=${tmux_conf_theme_window_status_activity_bg:-default} -# tmux_conf_theme_window_status_activity_attr=${tmux_conf_theme_window_status_activity_attr:-underscore} -# -# tmux_conf_theme_window_status_bell_fg=${tmux_conf_theme_window_status_bell_fg:-$tmux_conf_theme_colour_5} -# tmux_conf_theme_window_status_bell_bg=${tmux_conf_theme_window_status_bell_bg:-default} -# tmux_conf_theme_window_status_bell_attr=${tmux_conf_theme_window_status_bell_attr:-blink,bold} -# -# tmux_conf_theme_window_status_last_fg=${tmux_conf_theme_window_status_last_fg:-$tmux_conf_theme_colour_4} -# tmux_conf_theme_window_status_last_bg=${tmux_conf_theme_window_status_last_bg:-default} -# tmux_conf_theme_window_status_last_attr=${tmux_conf_theme_window_status_last_attr:-none} -# # # -- indicators # -# tmux_conf_theme_pairing=${tmux_conf_theme_pairing:-👓 } # U+1F453 +# tmux_conf_theme_pairing=${tmux_conf_theme_pairing:-⚇} # U+2687 # tmux_conf_theme_pairing_fg=${tmux_conf_theme_pairing_fg:-none} # tmux_conf_theme_pairing_bg=${tmux_conf_theme_pairing_bg:-none} # tmux_conf_theme_pairing_attr=${tmux_conf_theme_pairing_attr:-none} # -# tmux_conf_theme_prefix=${tmux_conf_theme_prefix:-⌨ } # U+2328 +# tmux_conf_theme_prefix=${tmux_conf_theme_prefix:-⌨} # U+2328 # tmux_conf_theme_prefix_fg=${tmux_conf_theme_prefix_fg:-none} # tmux_conf_theme_prefix_bg=${tmux_conf_theme_prefix_bg:-none} # tmux_conf_theme_prefix_attr=${tmux_conf_theme_prefix_attr:-none} @@ -951,7 +986,7 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # tmux_conf_theme_root_bg=${tmux_conf_theme_root_bg:-none} # tmux_conf_theme_root_attr=${tmux_conf_theme_root_attr:-bold,blink} # -# tmux_conf_theme_synchronized=${tmux_conf_theme_synchronized:-🔒} # U+1F512 +# tmux_conf_theme_synchronized=${tmux_conf_theme_synchronized:-⚏} # U+268F # tmux_conf_theme_synchronized_fg=${tmux_conf_theme_synchronized_fg:-none} # tmux_conf_theme_synchronized_bg=${tmux_conf_theme_synchronized_bg:-none} # tmux_conf_theme_synchronized_attr=${tmux_conf_theme_synchronized_attr:-none} @@ -965,9 +1000,9 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # # if [ -n "$tmux_conf_theme_status_left" ]; then # status_left=$(echo "$tmux_conf_theme_status_left" | sed \ -# -e "s/#{pairing}/#[fg=$tmux_conf_theme_pairing_fg]#[bg=$tmux_conf_theme_pairing_bg]#[$tmux_conf_theme_pairing_attr]#{?session_many_attached,$tmux_conf_theme_pairing,}/g" \ -# -e "s/#{prefix}/#[fg=$tmux_conf_theme_prefix_fg]#[bg=$tmux_conf_theme_prefix_bg]#[$tmux_conf_theme_prefix_attr]#{?client_prefix,$tmux_conf_theme_prefix,}/g" \ -# -e "s%#{synchronized}%#[fg=$tmux_conf_theme_synchronized_fg]#[bg=$tmux_conf_theme_synchronized_bg]#[$tmux_conf_theme_synchronized_attr]#{?pane_synchronized,$tmux_conf_theme_synchronized,}%g" \ +# -e "s/#{pairing}/#[fg=$tmux_conf_theme_pairing_fg]#[bg=$tmux_conf_theme_pairing_bg]#[$tmux_conf_theme_pairing_attr]#{?session_many_attached,$tmux_conf_theme_pairing ,}/g" \ +# -e "s/#{prefix}/#[fg=$tmux_conf_theme_prefix_fg]#[bg=$tmux_conf_theme_prefix_bg]#[$tmux_conf_theme_prefix_attr]#{?client_prefix$tmux_conf_theme_prefix ,$(print "$tmux_conf_theme_prefix" | sed -e 's/./ /g') }/g" \ +# -e "s%#{synchronized}%#[fg=$tmux_conf_theme_synchronized_fg]#[bg=$tmux_conf_theme_synchronized_bg]#[$tmux_conf_theme_synchronized_attr]#{?pane_synchronized,$tmux_conf_theme_synchronized ,}%g" \ # -e 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled #S)%g') # # if [ -n "$(tmux display -p '#{version}')" ]; then @@ -1053,9 +1088,9 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # # if [ -n "$tmux_conf_theme_status_right" ]; then # status_right=$(echo "$tmux_conf_theme_status_right" | sed \ -# -e "s/#{pairing}/#[fg=$tmux_conf_theme_pairing_fg]#[bg=$tmux_conf_theme_pairing_bg]#[$tmux_conf_theme_pairing_attr]#{?session_many_attached,$tmux_conf_theme_pairing,}/g" \ -# -e "s/#{prefix}/#[fg=$tmux_conf_theme_prefix_fg]#[bg=$tmux_conf_theme_prefix_bg]#[$tmux_conf_theme_prefix_attr]#{?client_prefix,$tmux_conf_theme_prefix,}/g" \ -# -e "s%#{synchronized}%#[fg=$tmux_conf_theme_synchronized_fg]#[bg=$tmux_conf_theme_synchronized_bg]#[$tmux_conf_theme_synchronized_attr]#{?pane_synchronized,$tmux_conf_theme_synchronized,}%g" \ +# -e "s/#{pairing}/#[fg=$tmux_conf_theme_pairing_fg]#[bg=$tmux_conf_theme_pairing_bg]#[$tmux_conf_theme_pairing_attr]#{?session_many_attached,$tmux_conf_theme_pairing ,}/g" \ +# -e "s/#{prefix}/#[fg=$tmux_conf_theme_prefix_fg]#[bg=$tmux_conf_theme_prefix_bg]#[$tmux_conf_theme_prefix_attr]#{?client_prefix,$tmux_conf_theme_prefix ,$(printf "$tmux_conf_theme_prefix" | sed -e 's/./ /g') }/g" \ +# -e "s%#{synchronized}%#[fg=$tmux_conf_theme_synchronized_fg]#[bg=$tmux_conf_theme_synchronized_bg]#[$tmux_conf_theme_synchronized_attr]#{?pane_synchronized,$tmux_conf_theme_synchronized ,}%g" \ # -e 's%#{circled_session_name}%#(cut -c3- ~/.tmux.conf | sh -s _circled #S)%g') # # if [ -n "$(tmux display -p '#{version}')" ]; then @@ -1262,6 +1297,7 @@ run -b '[ -z "#{window_active}" ] && [ -z "#{version}" ] && tmux set display-tim # setw -g window-status-activity-style "fg=$tmux_conf_theme_window_status_activity_fg,bg=$tmux_conf_theme_window_status_activity_bg,$tmux_conf_theme_window_status_activity_attr" \;\ # setw -g window-status-bell-style "fg=$tmux_conf_theme_window_status_bell_fg,bg=$tmux_conf_theme_window_status_bell_bg,$tmux_conf_theme_window_status_bell_attr" \;\ # setw -g window-status-last-style "fg=$tmux_conf_theme_window_status_last_fg,bg=$tmux_conf_theme_window_status_last_bg,$tmux_conf_theme_window_status_last_attr" \;\ +# setw -g window-status-separator "$window_status_separator" \;\ # set -g status-left-length 1000 \; set -g status-left "$(_decode_unicode_escapes "$status_left")" \;\ # set -g status-right-length 1000 \; set -g status-right "$(_decode_unicode_escapes "$status_right")" \;\ # setw -g clock-mode-colour "$tmux_conf_theme_clock_colour" \;\ diff --git a/.tmux.conf.local b/.tmux.conf.local index ce6dcb465..13697121b 100644 --- a/.tmux.conf.local +++ b/.tmux.conf.local @@ -180,7 +180,7 @@ tmux_conf_theme_window_status_bell_attr="blink,bold" # window last status style tmux_conf_theme_window_status_last_fg="$tmux_conf_theme_colour_4" -tmux_conf_theme_window_status_last_bg="default" +tmux_conf_theme_window_status_last_bg="$tmux_conf_theme_colour_2" tmux_conf_theme_window_status_last_attr="none" # status left/right sections separators @@ -218,7 +218,7 @@ tmux_conf_theme_right_separator_sub="|" # - #{username} # - #{username_ssh} tmux_conf_theme_status_left=" ❐ #S | ↑#{?uptime_y, #{uptime_y}y,}#{?uptime_d, #{uptime_d}d,}#{?uptime_h, #{uptime_h}h,}#{?uptime_m, #{uptime_m}m,} " -tmux_conf_theme_status_right="#{prefix}#{pairing}#{synchronized} #{?battery_status, #{battery_status},}#{?battery_bar, #{battery_bar},}#{?battery_percentage, #{battery_percentage},} , %R , %d %b | #{username}#{root} | #{hostname} " +tmux_conf_theme_status_right=" #{prefix}#{pairing}#{synchronized}#{?battery_status,#{battery_status},}#{?battery_bar, #{battery_bar},}#{?battery_percentage, #{battery_percentage},} , %R , %d %b | #{username_ssh}#{root} | #{hostname_ssh} " # status left style tmux_conf_theme_status_left_fg="$tmux_conf_theme_colour_6,$tmux_conf_theme_colour_7,$tmux_conf_theme_colour_8" @@ -231,13 +231,13 @@ tmux_conf_theme_status_right_bg="$tmux_conf_theme_colour_15,$tmux_conf_theme_col tmux_conf_theme_status_right_attr="none,none,bold" # pairing indicator -tmux_conf_theme_pairing="👓 " # U+1F453 +tmux_conf_theme_pairing="⚇" # U+2687 tmux_conf_theme_pairing_fg="none" tmux_conf_theme_pairing_bg="none" tmux_conf_theme_pairing_attr="none" # prefix indicator -tmux_conf_theme_prefix="⌨ " # U+2328 +tmux_conf_theme_prefix="⌨" # U+2328 tmux_conf_theme_prefix_fg="none" tmux_conf_theme_prefix_bg="none" tmux_conf_theme_prefix_attr="none" @@ -249,7 +249,7 @@ tmux_conf_theme_root_bg="none" tmux_conf_theme_root_attr="bold,blink" # synchronized indicator -tmux_conf_theme_synchronized="🔒" # U+1F512 +tmux_conf_theme_synchronized="⚏" # U+268F tmux_conf_theme_synchronized_fg="none" tmux_conf_theme_synchronized_bg="none" tmux_conf_theme_synchronized_attr="none"