Merge pull request #85 from Memije/master

Added padding at the end of left icon for custom args
This commit is contained in:
Ethan Edwards 2020-12-16 12:13:28 -05:00 committed by GitHub
commit fbb1c6b929
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 3 deletions

View file

@ -58,6 +58,7 @@ Customize the status bar by adding any of these lines to your .tmux.conf as desi
* 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`
* Switch the left smiley icon `set -g @dracula-show-left-icon session` it can accept `session`, `smiley`, `window`, or any character. * Switch the left smiley icon `set -g @dracula-show-left-icon session` it can accept `session`, `smiley`, `window`, or any character.
* Add padding to the left smiley icon `set -g @dracula-left-icon-padding` default is 1, it can accept any number and 0 disables padding.
* Enable high contrast pane border: `set -g @dracula-border-contrast true` * Enable high contrast pane border: `set -g @dracula-border-contrast true`
* Enable cpu usage: `set -g @dracula-cpu-usage true` * Enable cpu usage: `set -g @dracula-cpu-usage true`
* Enable ram usage: `set -g @dracula-ram-usage true` * Enable ram usage: `set -g @dracula-ram-usage true`

View file

@ -27,6 +27,7 @@ main()
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_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_left_icon_padding=$(get_tmux_option "@dracula-left-icon-padding" 1)
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)
show_left_sep=$(get_tmux_option "@dracula-show-left-sep") show_left_sep=$(get_tmux_option "@dracula-show-left-sep")
@ -56,15 +57,22 @@ main()
# Handle left icon configuration # Handle left icon configuration
case $show_left_icon in case $show_left_icon in
smiley) smiley)
left_icon="☺ ";; left_icon="☺";;
session) session)
left_icon="#S ";; left_icon="#S";;
window) window)
left_icon="#W ";; left_icon="#W";;
*) *)
left_icon=$show_left_icon;; left_icon=$show_left_icon;;
esac esac
# Handle left icon padding
padding=""
if [ "$show_left_icon_padding" -gt "0" ]; then
padding="$(seq -f " " -s '' $show_left_icon_padding)"
fi
left_icon="$left_icon$padding"
# Handle powerline option # Handle powerline option
if $show_powerline; then if $show_powerline; then
right_sep="$show_right_sep" right_sep="$show_right_sep"