@@ -22,12 +22,12 @@ print_powerline_side() {
22
22
print_powerline_window_status_current_format () {
23
23
if [ -z " $TMUX_POWERLINE_WINDOW_STATUS_CURRENT " ]; then
24
24
TMUX_POWERLINE_WINDOW_STATUS_CURRENT=(
25
- " #[$( format inverse) ]" \
26
- " $TMUX_POWERLINE_DEFAULT_LEFTSIDE_SEPARATOR " \
27
- " #I#F " \
28
- " $TMUX_POWERLINE_SEPARATOR_RIGHT_THIN " \
29
- " #W " \
30
- " #[$( format regular) ]" \
25
+ " #[$( format inverse) ]"
26
+ " $TMUX_POWERLINE_DEFAULT_LEFTSIDE_SEPARATOR "
27
+ " #I#F "
28
+ " $TMUX_POWERLINE_SEPARATOR_RIGHT_THIN "
29
+ " #W "
30
+ " #[$( format regular) ]"
31
31
" $TMUX_POWERLINE_DEFAULT_LEFTSIDE_SEPARATOR "
32
32
)
33
33
fi
@@ -38,9 +38,9 @@ print_powerline_window_status_current_format() {
38
38
print_powerline_window_status_format () {
39
39
if [ -z " $TMUX_POWERLINE_WINDOW_STATUS_FORMAT " ]; then
40
40
TMUX_POWERLINE_WINDOW_STATUS_FORMAT=(
41
- " #[$( format regular) ]" \
42
- " #I#{?window_flags,#F, } " \
43
- " $TMUX_POWERLINE_SEPARATOR_RIGHT_THIN " \
41
+ " #[$( format regular) ]"
42
+ " #I#{?window_flags,#F, } "
43
+ " $TMUX_POWERLINE_SEPARATOR_RIGHT_THIN "
44
44
" #W "
45
45
)
46
46
fi
@@ -57,31 +57,30 @@ format() {
57
57
fg_color=$( __normalize_color " $TMUX_POWERLINE_DEFAULT_FOREGROUND_COLOR " )
58
58
59
59
case $type in
60
- inverse)
61
- echo " fg=$bg_color ,bg=$fg_color ,nobold,noitalics,nounderscore"
62
- ;;
63
- regular)
64
- echo " fg=$fg_color ,bg=$bg_color ,nobold,noitalics,nounderscore"
65
- ;;
66
- * )
67
- ;;
60
+ inverse)
61
+ echo " fg=$bg_color ,bg=$fg_color ,nobold,noitalics,nounderscore"
62
+ ;;
63
+ regular)
64
+ echo " fg=$fg_color ,bg=$bg_color ,nobold,noitalics,nounderscore"
65
+ ;;
66
+ * ) ;;
68
67
esac
69
68
}
70
69
71
70
__process_segment_defaults () {
72
71
# shellcheck disable=SC2154 # disable until we found a better solution for eval input_segments
73
72
for segment_index in " ${! input_segments[@]} " ; do
74
73
local input_segment
75
- read -r -a input_segment <<< " ${input_segments[segment_index]}"
74
+ read -r -a input_segment <<< " ${input_segments[segment_index]}"
76
75
eval " local default_separator=\$ TMUX_POWERLINE_DEFAULT_${upper_side} SIDE_SEPARATOR"
77
76
78
77
powerline_segment_with_defaults=(
79
- " ${input_segment[0]:- no_script} " \
80
- " ${input_segment[1]:- $TMUX_POWERLINE_DEFAULT_BACKGROUND_COLOR } " \
81
- " ${input_segment[2]:- $TMUX_POWERLINE_DEFAULT_FOREGROUND_COLOR } " \
82
- " ${input_segment[3]:- $default_separator } " \
83
- " ${input_segment[6]:- $spacing_disable } " \
84
- " ${input_segment[7]:- $separator_disable } " \
78
+ " ${input_segment[0]:- no_script} "
79
+ " ${input_segment[1]:- $TMUX_POWERLINE_DEFAULT_BACKGROUND_COLOR } "
80
+ " ${input_segment[2]:- $TMUX_POWERLINE_DEFAULT_FOREGROUND_COLOR } "
81
+ " ${input_segment[3]:- $default_separator } "
82
+ " ${input_segment[6]:- $spacing_disable } "
83
+ " ${input_segment[7]:- $separator_disable } "
85
84
)
86
85
87
86
powerline_segments[segment_index]=" ${powerline_segment_with_defaults[*]} "
@@ -91,9 +90,9 @@ __process_segment_defaults() {
91
90
__process_scripts () {
92
91
for segment_index in " ${! powerline_segments[@]} " ; do
93
92
local powerline_segment
94
- read -r -a powerline_segment <<< " ${powerline_segments[segment_index]}"
93
+ read -r -a powerline_segment <<< " ${powerline_segments[segment_index]}"
95
94
96
- if [ -n " $TMUX_POWERLINE_DIR_USER_SEGMENTS " ] && [ -f " $TMUX_POWERLINE_DIR_USER_SEGMENTS /${powerline_segment[0]} .sh" ] ; then
95
+ if [ -n " $TMUX_POWERLINE_DIR_USER_SEGMENTS " ] && [ -f " $TMUX_POWERLINE_DIR_USER_SEGMENTS /${powerline_segment[0]} .sh" ]; then
97
96
local script=" $TMUX_POWERLINE_DIR_USER_SEGMENTS /${powerline_segment[0]} .sh"
98
97
else
99
98
local script=" $TMUX_POWERLINE_DIR_SEGMENTS /${powerline_segment[0]} .sh"
@@ -109,7 +108,7 @@ __process_scripts() {
109
108
local exit_code=" $? "
110
109
unset -f run_segment
111
110
112
- if [ " $exit_code " -ne 0 ] && debug_mode_enabled ; then
111
+ if [ " $exit_code " -ne 0 ] && debug_mode_enabled; then
113
112
local seg_name=" ${script##*/ } "
114
113
echo " Segment '${seg_name} ' exited with code ${exit_code} . Aborting."
115
114
exit 1
@@ -134,14 +133,14 @@ __process_scripts() {
134
133
__process_colors () {
135
134
for segment_index in " ${! powerline_segments[@]} " ; do
136
135
local powerline_segment
137
- read -r -a powerline_segment <<< " ${powerline_segments[segment_index]}"
136
+ read -r -a powerline_segment <<< " ${powerline_segments[segment_index]}"
138
137
local separator_enable=${powerline_segment[5]}
139
138
# Find the next segment that produces content (i.e. skip empty segments).
140
- for next_segment_index in $( eval echo " {$(( segment_index + 1 )) ..${# powerline_segments} }" ) ; do
139
+ for next_segment_index in $( eval echo " {$(( segment_index + 1 )) ..${# powerline_segments} }" ) ; do
141
140
[[ -n ${powerline_segments[next_segment_index]} ]] && break
142
141
done
143
142
local next_segment
144
- read -r -a next_segment <<< " ${powerline_segments[next_segment_index]}"
143
+ read -r -a next_segment <<< " ${powerline_segments[next_segment_index]}"
145
144
146
145
if [ " $side " == ' left' ]; then
147
146
powerline_segment[4]=${next_segment[1]:- $TMUX_POWERLINE_DEFAULT_BACKGROUND_COLOR }
@@ -165,7 +164,7 @@ __process_colors() {
165
164
__process_powerline () {
166
165
for segment_index in " ${! powerline_segments[@]} " ; do
167
166
local powerline_segment
168
- read -r -a powerline_segment <<< " ${powerline_segments[segment_index]}"
167
+ read -r -a powerline_segment <<< " ${powerline_segments[segment_index]}"
169
168
170
169
local background_color=${powerline_segment[1]}
171
170
local foreground_color=${powerline_segment[2]}
@@ -188,7 +187,7 @@ __print_left_segment() {
188
187
local separator_disable=$7
189
188
190
189
__print_colored_content " $content " " $content_background_color " " $content_foreground_color "
191
- if [ ! " $separator_disable " == " separator_disable" ] ; then
190
+ if [ ! " $separator_disable " == " separator_disable" ]; then
192
191
__print_colored_content " $separator " " $separator_background_color " " $separator_foreground_color "
193
192
fi
194
193
}
@@ -202,19 +201,18 @@ __print_right_segment() {
202
201
local separator_foreground_color=$6
203
202
local separator_disable=$7
204
203
205
- if [ ! " $separator_disable " == " separator_disable" ] ; then
204
+ if [ ! " $separator_disable " == " separator_disable" ]; then
206
205
__print_colored_content " $separator " " $separator_background_color " " $separator_foreground_color "
207
206
fi
208
207
__print_colored_content " $content " " $content_background_color " " $content_foreground_color "
209
208
}
210
209
211
210
__segment_separator_is_thin () {
212
- [[ ${powerline_segment[3]} == " $TMUX_POWERLINE_SEPARATOR_LEFT_THIN " || \
213
- ${powerline_segment[3]} == " $TMUX_POWERLINE_SEPARATOR_RIGHT_THIN " ]];
211
+ [[ ${powerline_segment[3]} == " $TMUX_POWERLINE_SEPARATOR_LEFT_THIN " || ${powerline_segment[3]} == " $TMUX_POWERLINE_SEPARATOR_RIGHT_THIN " ]]
214
212
}
215
213
216
214
__check_platform () {
217
215
if [ " $SHELL_PLATFORM " == " unknown" ] && debug_mode_enabled; then
218
- echo " Unknown platform; modify config/shell.sh" >&2
216
+ echo " Unknown platform; modify config/shell.sh" >&2
219
217
fi
220
218
}
0 commit comments