Merge pull request #175 from aaronkollasch/show-hide-empty-plugins

Add option to show/hide plugins with empty output
This commit is contained in:
Ethan Edwards 2023-04-08 14:49:09 -04:00 committed by GitHub
commit 3a7ea6fc0b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -27,6 +27,7 @@ main()
time_format=$(get_tmux_option "@dracula-time-format" "%Y-%m-%d(%a) %H:%M") time_format=$(get_tmux_option "@dracula-time-format" "%Y-%m-%d(%a) %H:%M")
show_kubernetes_context_label=$(get_tmux_option "@dracula-kubernetes-context-label" "") show_kubernetes_context_label=$(get_tmux_option "@dracula-kubernetes-context-label" "")
IFS=' ' read -r -a plugins <<< $(get_tmux_option "@dracula-plugins" "battery network weather") IFS=' ' read -r -a plugins <<< $(get_tmux_option "@dracula-plugins" "battery network weather")
show_empty_plugins=$(get_tmux_option "@dracula-show-empty-plugins" true)
# Dracula Color Pallette # Dracula Color Pallette
white='#f8f8f2' white='#f8f8f2'
@ -212,10 +213,18 @@ main()
fi fi
if $show_powerline; then if $show_powerline; then
if $show_empty_plugins; then
tmux set-option -ga status-right "#[fg=${!colors[0]},bg=${powerbg},nobold,nounderscore,noitalics]${right_sep}#[fg=${!colors[1]},bg=${!colors[0]}] $script " tmux set-option -ga status-right "#[fg=${!colors[0]},bg=${powerbg},nobold,nounderscore,noitalics]${right_sep}#[fg=${!colors[1]},bg=${!colors[0]}] $script "
else
tmux set-option -ga status-right "#{?#{==:$script,},,#[fg=${!colors[0]},nobold,nounderscore,noitalics]${right_sep}#[fg=${!colors[1]},bg=${!colors[0]}] $script }"
fi
powerbg=${!colors[0]} powerbg=${!colors[0]}
else else
if $show_empty_plugins; then
tmux set-option -ga status-right "#[fg=${!colors[1]},bg=${!colors[0]}] $script " tmux set-option -ga status-right "#[fg=${!colors[1]},bg=${!colors[0]}] $script "
else
tmux set-option -ga status-right "#{?#{==:$script,},,#[fg=${!colors[1]},bg=${!colors[0]}] $script }"
fi
fi fi
done done