Skip to content

Commit 50c1c33

Browse files
Merge pull request #299 from Heyian/master
Add transparent background to the powerline
2 parents 1109c09 + a9ba36c commit 50c1c33

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

scripts/dracula.sh

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ main()
1818
show_location=$(get_tmux_option "@dracula-show-location" true)
1919
fixed_location=$(get_tmux_option "@dracula-fixed-location")
2020
show_powerline=$(get_tmux_option "@dracula-show-powerline" false)
21+
transparent_powerline_bg=$(get_tmux_option "@dracula-transparent-powerline-bg" false)
2122
show_flags=$(get_tmux_option "@dracula-show-flags" false)
2223
show_left_icon=$(get_tmux_option "@dracula-show-left-icon" smiley)
2324
show_left_icon_padding=$(get_tmux_option "@dracula-left-icon-padding" 1)
@@ -26,6 +27,7 @@ main()
2627
show_timezone=$(get_tmux_option "@dracula-show-timezone" true)
2728
show_left_sep=$(get_tmux_option "@dracula-show-left-sep")
2829
show_right_sep=$(get_tmux_option "@dracula-show-right-sep")
30+
show_inverse_divider=$(get_tmux_option "@dracula-inverse-divider")
2931
show_border_contrast=$(get_tmux_option "@dracula-border-contrast" false)
3032
show_day_month=$(get_tmux_option "@dracula-day-month" false)
3133
show_refresh=$(get_tmux_option "@dracula-refresh-rate" 5)
@@ -49,6 +51,19 @@ main()
4951
pink=$(get_tmux_option "@dracula-color-pink" "#ff79c6")
5052
yellow=$(get_tmux_option "@dracula-color-yellow" "#f1fa8c")
5153

54+
# Set transparency variables - Colors and window dividers
55+
if $transparent_powerline_bg; then
56+
bg_color="default"
57+
window_sep_fg=${dark_purple}
58+
window_sep_bg=default
59+
window_sep="$show_inverse_divider"
60+
else
61+
bg_color=${gray}
62+
window_sep_fg=${gray}
63+
window_sep_bg=${dark_purple}
64+
window_sep="$show_left_sep"
65+
fi
66+
5267
# Handle left icon configuration
5368
case $show_left_icon in
5469
smiley)
@@ -123,12 +138,12 @@ main()
123138
tmux set-option -g message-style "bg=${gray},fg=${white}"
124139

125140
# status bar
126-
tmux set-option -g status-style "bg=${gray},fg=${white}"
141+
tmux set-option -g status-style "bg=${bg_color},fg=${white}"
127142

128143
# Status left
129144
if $show_powerline; then
130-
tmux set-option -g status-left "#[bg=${green},fg=${dark_gray}]#{?client_prefix,#[bg=${yellow}],} ${left_icon} #[fg=${green},bg=${gray}]#{?client_prefix,#[fg=${yellow}],}${left_sep}"
131-
powerbg=${gray}
145+
tmux set-option -g status-left "#[bg=${green},fg=${dark_gray}]#{?client_prefix,#[bg=${yellow}],} ${left_icon} #[fg=${green},bg=${bg_color}]#{?client_prefix,#[fg=${yellow}],}${left_sep}"
146+
powerbg=${bg_color}
132147
else
133148
tmux set-option -g status-left "#[bg=${green},fg=${dark_gray}]#{?client_prefix,#[bg=${yellow}],} ${left_icon}"
134149
fi
@@ -295,12 +310,12 @@ main()
295310

296311
# Window option
297312
if $show_powerline; then
298-
tmux set-window-option -g window-status-current-format "#[fg=${gray},bg=${dark_purple}]${left_sep}#[fg=${white},bg=${dark_purple}] #I #W${current_flags} #[fg=${dark_purple},bg=${gray}]${left_sep}"
313+
tmux set-window-option -g window-status-current-format "#[fg=${window_sep_fg},bg=${window_sep_bg}]${window_sep}#[fg=${white},bg=${dark_purple}] #I #W${current_flags} #[fg=${dark_purple},bg=${bg_color}]${left_sep}"
299314
else
300315
tmux set-window-option -g window-status-current-format "#[fg=${white},bg=${dark_purple}] #I #W${current_flags} "
301316
fi
302317

303-
tmux set-window-option -g window-status-format "#[fg=${white}]#[bg=${gray}] #I #W${flags}"
318+
tmux set-window-option -g window-status-format "#[fg=${white}]#[bg=${bg_color}] #I #W${flags}"
304319
tmux set-window-option -g window-status-activity-style "bold"
305320
tmux set-window-option -g window-status-bell-style "bold"
306321
}

0 commit comments

Comments
 (0)