Merge pull request #75 from spoulson/47_window-flags

47: Enable window flags with `set -g @dracula-show-flags true`.
This commit is contained in:
Ethan Edwards 2020-10-07 03:47:22 -04:00 committed by GitHub
commit e18c92743f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 9 deletions

View file

@ -21,6 +21,7 @@ Customize the status bar by adding any of these lines to your .tmux.conf as desi
* Switch from default fahrenheit to celsius: `set -g @dracula-show-fahrenheit false` * Switch from default fahrenheit to celsius: `set -g @dracula-show-fahrenheit false`
* Enable powerline symbols: `set -g @dracula-show-powerline true` * Enable powerline symbols: `set -g @dracula-show-powerline true`
* Switch powerline symbols `set -g @dracula-show-left-sep ` for left and `set -g @dracula-show-right-sep ` for right symbol (can set any symbol you like as seperator) * Switch powerline symbols `set -g @dracula-show-left-sep ` for left and `set -g @dracula-show-right-sep ` for right symbol (can set any symbol you like as seperator)
* Enable window flags: `set -g @dracula-show-flags true`
* Adjust the refresh rate for the bar `set -g @dracula-refresh-rate 5` the default is 5, it can accept any number * Adjust the refresh rate for the bar `set -g @dracula-refresh-rate 5` the default is 5, it can accept any number
* Enable military time: `set -g @dracula-military-time true` * Enable military time: `set -g @dracula-military-time true`
* Disable timezone: `set -g @dracula-show-timezone false` * Disable timezone: `set -g @dracula-show-timezone false`

View file

@ -22,6 +22,7 @@ main()
show_weather=$(get_tmux_option "@dracula-show-weather" true) show_weather=$(get_tmux_option "@dracula-show-weather" true)
show_fahrenheit=$(get_tmux_option "@dracula-show-fahrenheit" true) show_fahrenheit=$(get_tmux_option "@dracula-show-fahrenheit" true)
show_powerline=$(get_tmux_option "@dracula-show-powerline" false) show_powerline=$(get_tmux_option "@dracula-show-powerline" false)
show_flags=$(get_tmux_option "@dracula-show-flags" false)
show_left_icon=$(get_tmux_option "@dracula-show-left-icon" smiley) show_left_icon=$(get_tmux_option "@dracula-show-left-icon" smiley)
show_military=$(get_tmux_option "@dracula-military-time" false) show_military=$(get_tmux_option "@dracula-military-time" false)
show_timezone=$(get_tmux_option "@dracula-show-timezone" true) show_timezone=$(get_tmux_option "@dracula-show-timezone" true)
@ -47,7 +48,7 @@ main()
red='#ff5555' red='#ff5555'
pink='#ff79c6' pink='#ff79c6'
yellow='#f1fa8c' yellow='#f1fa8c'
# Handle left icon configuration # Handle left icon configuration
case $show_left_icon in case $show_left_icon in
@ -80,6 +81,15 @@ main()
timezone="#(date +%Z)";; timezone="#(date +%Z)";;
esac esac
case $show_flags in
false)
flags=""
current_flags="";;
true)
flags="#{?window_flags,#[fg=${dark_purple}]#{window_flags},}"
current_flags="#{?window_flags,#[fg=${light_purple}]#{window_flags},}"
esac
# sets refresh interval to every 5 seconds # sets refresh interval to every 5 seconds
tmux set-option -g status-interval $show_refresh tmux set-option -g status-interval $show_refresh
@ -90,7 +100,7 @@ main()
tmux set-option -g clock-mode-style 12 tmux set-option -g clock-mode-style 12
fi fi
# set length # set length
tmux set-option -g status-left-length 100 tmux set-option -g status-left-length 100
tmux set-option -g status-right-length 100 tmux set-option -g status-right-length 100
@ -139,7 +149,7 @@ main()
if $show_gpu_usage; then if $show_gpu_usage; then
tmux set-option -ga status-right "#[fg=${pink},bg=${powerbg},nobold,nounderscore,noitalics] ${right_sep}#[fg=${dark_gray},bg=${pink}] #($current_dir/gpu_usage.sh)" tmux set-option -ga status-right "#[fg=${pink},bg=${powerbg},nobold,nounderscore,noitalics] ${right_sep}#[fg=${dark_gray},bg=${pink}] #($current_dir/gpu_usage.sh)"
powerbg=${pink} powerbg=${pink}
fi fi
if $show_network; then # network if $show_network; then # network
tmux set-option -ga status-right "#[fg=${cyan},bg=${powerbg},nobold,nounderscore,noitalics] ${right_sep}#[fg=${dark_gray},bg=${cyan}] #($current_dir/network.sh)" tmux set-option -ga status-right "#[fg=${cyan},bg=${powerbg},nobold,nounderscore,noitalics] ${right_sep}#[fg=${dark_gray},bg=${cyan}] #($current_dir/network.sh)"
@ -163,8 +173,8 @@ main()
fi fi
fi fi
tmux set-window-option -g window-status-current-format "#[fg=${gray},bg=${dark_purple}]${left_sep}#[fg=${white},bg=${dark_purple}] #I #W #[fg=${dark_purple},bg=${gray}]${left_sep}" 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}"
# Non Powerline Configuration # Non Powerline Configuration
else else
tmux set-option -g status-left "#[bg=${green},fg=${dark_gray}]#{?client_prefix,#[bg=${yellow}],} ${left_icon}" tmux set-option -g status-left "#[bg=${green},fg=${dark_gray}]#{?client_prefix,#[bg=${yellow}],} ${left_icon}"
@ -184,7 +194,7 @@ main()
if $show_gpu_usage; then if $show_gpu_usage; then
tmux set-option -ga status-right "#[fg=${dark_gray},bg=${pink}] #($current_dir/gpu_usage.sh) " tmux set-option -ga status-right "#[fg=${dark_gray},bg=${pink}] #($current_dir/gpu_usage.sh) "
fi fi
if $show_network; then # network if $show_network; then # network
tmux set-option -ga status-right "#[fg=${dark_gray},bg=${cyan}] #($current_dir/network.sh) " tmux set-option -ga status-right "#[fg=${dark_gray},bg=${cyan}] #($current_dir/network.sh) "
@ -206,11 +216,13 @@ main()
fi fi
fi fi
tmux set-window-option -g window-status-current-format "#[fg=${white},bg=${dark_purple}] #I #W " tmux set-window-option -g window-status-current-format "#[fg=${white},bg=${dark_purple}] #I #W${current_flags} "
fi fi
tmux set-window-option -g window-status-format "#[fg=${white}]#[bg=${gray}] #I #W " tmux set-window-option -g window-status-format "#[fg=${white}]#[bg=${gray}] #I #W${flags}"
tmux set-window-option -g window-status-activity-style "bold"
tmux set-window-option -g window-status-bell-style "bold"
} }
# run main function # run main function