66place_holder=" \#{prefix_highlight}"
77
88# Possible configurations
9+ option_scope_config=' @prefix_highlight_option_scope'
910fg_color_config=' @prefix_highlight_fg'
1011bg_color_config=' @prefix_highlight_bg'
1112output_prefix=' @prefix_highlight_output_prefix'
@@ -22,7 +23,7 @@ empty_attr_config='@prefix_highlight_empty_attr'
2223empty_has_affixes=' @prefix_highlight_empty_has_affixes'
2324
2425tmux_option () {
25- local -r value=$( tmux show-option -gqv " $1 " )
26+ local -r value=$( tmux show-option -Aqv " $1 " )
2627 local -r default=" $2 "
2728
2829 if [ -n " $value " ]; then
@@ -36,6 +37,14 @@ format_style() {
3637 echo " #[${1} ]" | sed -e ' s/,/]#[/g'
3738}
3839
40+ interpolate () {
41+ local -r option=$1
42+ local -r replacement=$2
43+ local -r option_scope=${3# -}
44+ local -r option_value=$( tmux_option " $option " )
45+ tmux set-option -" $option_scope " q " $option " " ${option_value/ $place_holder / $replacement } "
46+ }
47+
3948# Defaults
4049default_fg=' colour231'
4150default_bg=' colour04'
@@ -49,6 +58,7 @@ default_empty_prompt=''
4958
5059main () {
5160 local -r \
61+ option_scope=$( tmux_option " $option_scope_config " " g" ) \
5262 fg_color=$( tmux_option " $fg_color_config " " $default_fg " ) \
5363 bg_color=$( tmux_option " $bg_color_config " " $default_bg " ) \
5464 show_copy_mode=$( tmux_option " $show_copy_config " " off" ) \
@@ -94,11 +104,9 @@ main() {
94104
95105 local -r highlight=" #{?client_prefix,$prefix_mode ,$fallback }#[default]"
96106
97- local -r status_left_value=" $( tmux_option " status-left" ) "
98- tmux set-option -gq " status-left" " ${status_left_value/ $place_holder / $highlight } "
107+ interpolate " status-left" " $highlight " " $option_scope "
99108
100- local -r status_right_value=" $( tmux_option " status-right" ) "
101- tmux set-option -gq " status-right" " ${status_right_value/ $place_holder / $highlight } "
109+ interpolate " status-right" " $highlight " " $option_scope "
102110}
103111
104112main
0 commit comments