@@ -11,9 +11,12 @@ bg_color_config='@prefix_highlight_bg'
1111output_prefix=' @prefix_highlight_output_prefix'
1212output_suffix=' @prefix_highlight_output_suffix'
1313show_copy_config=' @prefix_highlight_show_copy_mode'
14+ show_sync_config=' @prefix_highlight_show_sync_mode'
1415copy_attr_config=' @prefix_highlight_copy_mode_attr'
16+ sync_attr_config=' @prefix_highlight_sync_attr'
1517prefix_prompt=' @prefix_highlight_prefix_prompt'
1618copy_prompt=' @prefix_highlight_copy_prompt'
19+ sync_prompt=' @prefix_highlight_sync_prompt'
1720empty_prompt=' @prefix_highlight_empty_prompt'
1821empty_attr_config=' @prefix_highlight_empty_attr'
1922empty_has_affixes=' @prefix_highlight_empty_has_affixes'
@@ -22,7 +25,7 @@ tmux_option() {
2225 local -r value=$( tmux show-option -gqv " $1 " )
2326 local -r default=" $2 "
2427
25- if [ ! -z " $value " ]; then
28+ if [ -n " $value " ]; then
2629 echo " $value "
2730 else
2831 echo " $default "
@@ -33,9 +36,11 @@ tmux_option() {
3336default_fg=' colour231'
3437default_bg=' colour04'
3538default_copy_attr=' fg=default,bg=yellow'
39+ default_sync_attr=' fg=default,bg=yellow'
3640default_empty_attr=' fg=default,bg=default'
3741default_prefix_prompt=$( tmux_option prefix | tr " [:lower:]" " [:upper:]" | sed ' s/C-/\^/' )
3842default_copy_prompt=' Copy'
43+ default_sync_prompt=' Sync'
3944default_empty_prompt=' '
4045
4146highlight () {
@@ -44,15 +49,19 @@ highlight() {
4449 prefix=" $2 " \
4550 prefix_highlight=" $3 " \
4651 show_copy_mode=" $4 " \
47- copy_highlight=" $5 " \
48- output_prefix=" $6 " \
49- output_suffix=" $7 " \
50- copy=" $8 " \
51- empty=" $9 "
52+ show_sync_mode=" $5 " \
53+ copy_highlight=" $6 " \
54+ sync_highlight=" $7 " \
55+ output_prefix=" $8 " \
56+ output_suffix=" $9 " \
57+ copy=" ${10} " \
58+ sync=" ${11} " \
59+ empty=" ${12} "
5260
5361 local -r status_value=" $( tmux_option " $status " ) "
5462 local -r prefix_with_optional_affixes=" $output_prefix$prefix$output_suffix "
5563 local -r copy_with_optional_affixes=" $output_prefix$copy$output_suffix "
64+ local -r sync_with_optional_affixes=" $output_prefix$sync$output_suffix "
5665
5766 if [[ " on" = " $empty_has_affixes " ]]; then
5867 local -r empty_with_optional_affixes=" $output_prefix$empty$output_suffix "
@@ -61,12 +70,17 @@ highlight() {
6170 fi
6271
6372 if [[ " on" = " $show_copy_mode " ]]; then
64- local -r fallback=" ${copy_highlight} #{?pane_in_mode,$copy_with_optional_affixes ,${empty_highlight} $empty_with_optional_affixes }"
65- else
66- local -r fallback=" ${empty_highlight} $empty_with_optional_affixes "
73+ local -r copy_mode=" ${copy_highlight} #{?pane_in_mode,$copy_with_optional_affixes ,}"
74+ fi
75+
76+ if [[ " on" = " $show_sync_mode " ]]; then
77+ local -r sync_panes=" ${sync_highlight} #{?synchronize-panes,$sync_with_optional_affixes ,}"
6778 fi
6879
69- local -r highlight_on_prefix=" ${prefix_highlight} #{?client_prefix,$prefix_with_optional_affixes ,$fallback }#[default]"
80+ local -r extended_highlights=" ${copy_mode}${sync_panes} "
81+ local -r client_prefix=" #{?client_prefix,$prefix_with_optional_affixes ,$empty_with_optional_affixes }"
82+
83+ local -r highlight_on_prefix=" ${prefix_highlight}${client_prefix}${extended_highlights} #[default]"
7084 tmux set-option -gq " $status " " ${status_value/ $place_holder / $highlight_on_prefix } "
7185}
7286
@@ -75,28 +89,35 @@ main() {
7589 fg_color=$( tmux_option " $fg_color_config " " $default_fg " ) \
7690 bg_color=$( tmux_option " $bg_color_config " " $default_bg " ) \
7791 show_copy_mode=$( tmux_option " $show_copy_config " " off" ) \
92+ show_sync_mode=$( tmux_option " $show_sync_config " " off" ) \
7893 output_prefix=$( tmux_option " $output_prefix " " " ) \
7994 output_suffix=$( tmux_option " $output_suffix " " " ) \
8095 copy_attr=$( tmux_option " $copy_attr_config " " $default_copy_attr " ) \
96+ sync_attr=$( tmux_option " $sync_attr_config " " $default_sync_attr " ) \
8197 prefix_prompt=$( tmux_option " $prefix_prompt " " $default_prefix_prompt " ) \
8298 copy_prompt=$( tmux_option " $copy_prompt " " $default_copy_prompt " ) \
99+ sync_prompt=$( tmux_option " $sync_prompt " " $default_sync_prompt " ) \
83100 empty_prompt=$( tmux_option " $empty_prompt " " $default_empty_prompt " ) \
84101 empty_attr=$( tmux_option " $empty_attr_config " " $default_empty_attr " ) \
85102 empty_has_affixes=$( tmux_option " $empty_has_affixes " " off" )
86103
87104 local -r \
88105 prefix_highlight=" #[fg=$fg_color ,bg=$bg_color ]" \
89106 copy_highlight=" ${copy_attr: +# [default,$copy_attr]} " \
107+ sync_highlight=" ${sync_attr: +# [default,$sync_attr]} " \
90108 empty_highlight=" ${empty_attr: +# [default,$empty_attr]} "
91109
92110 highlight " status-right" \
93111 " $prefix_prompt " \
94112 " $prefix_highlight " \
95113 " $show_copy_mode " \
114+ " $show_sync_mode " \
96115 " $copy_highlight " \
116+ " $sync_highlight " \
97117 " $output_prefix " \
98118 " $output_suffix " \
99119 " $copy_prompt " \
120+ " $sync_prompt " \
100121 " $empty_prompt " \
101122 " $empty_highlight " \
102123 " $empty_has_affixes "
@@ -105,10 +126,13 @@ main() {
105126 " $prefix_prompt " \
106127 " $prefix_highlight " \
107128 " $show_copy_mode " \
129+ " $show_sync_mode " \
108130 " $copy_highlight " \
131+ " $sync_highlight " \
109132 " $output_prefix " \
110133 " $output_suffix " \
111134 " $copy_prompt " \
135+ " $sync_prompt " \
112136 " $empty_prompt " \
113137 " $empty_highlight " \
114138 " $empty_has_affixes "
0 commit comments