Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/ enhancement: custom start and end of tmux status bar options #306

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
5 changes: 5 additions & 0 deletions docs/CONFIG.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ Enable powerline symbols
set -g @dracula-show-powerline true
```

Enable edge icons
```bash
set -g @dracula-show-edge-icons true
```

Switch powerline symbols

```bash
Expand Down
51 changes: 38 additions & 13 deletions scripts/dracula.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ export LC_ALL=en_US.UTF-8
current_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source $current_dir/utils.sh

main()
{
main() {
# set configuration option variables
show_krbtgt_label=$(get_tmux_option "@dracula-krbtgt-context-label" "")
krbtgt_principal=$(get_tmux_option "@dracula-krbtgt-principal" "")
Expand All @@ -29,6 +28,7 @@ main()
show_timezone=$(get_tmux_option "@dracula-show-timezone" true)
show_left_sep=$(get_tmux_option "@dracula-show-left-sep" )
show_right_sep=$(get_tmux_option "@dracula-show-right-sep" )
show_edge_icons=$(get_tmux_option "@dracula-show-edge-icons" false)
show_inverse_divider=$(get_tmux_option "@dracula-inverse-divider" )
show_border_contrast=$(get_tmux_option "@dracula-border-contrast" false)
show_day_month=$(get_tmux_option "@dracula-day-month" false)
Expand Down Expand Up @@ -61,15 +61,27 @@ main()

# Set transparency variables - Colors and window dividers
if $transparent_powerline_bg; then
bg_color="default"
window_sep_fg=${dark_purple}
window_sep_bg=default
window_sep="$show_inverse_divider"
bg_color="default"
if $show_edge_icons; then
window_sep_fg=${dark_purple}
window_sep_bg=default
window_sep="$show_right_sep"
else
window_sep_fg=${dark_purple}
window_sep_bg=default
window_sep="$show_inverse_divider"
fi
else
bg_color=${gray}
window_sep_fg=${gray}
window_sep_bg=${dark_purple}
window_sep="$show_left_sep"
if $show_edge_icons; then
window_sep_fg=${dark_purple}
window_sep_bg=${gray}
window_sep="$show_inverse_divider"
else
window_sep_fg=${gray}
window_sep_bg=${dark_purple}
window_sep="$show_left_sep"
fi
fi

# Handle left icon configuration
Expand Down Expand Up @@ -150,7 +162,11 @@ main()

# Status left
if $show_powerline; then
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}"
if $show_edge_icons; then
tmux set-option -g status-left "#[bg=${bg_color},fg=${green},bold]#{?client_prefix,#[fg=${yellow}],}${show_right_sep}#[bg=${green},fg=${dark_gray}]#{?client_prefix,#[bg=${yellow}],} ${left_icon} #[fg=${green},bg=${bg_color}]#{?client_prefix,#[fg=${yellow}],}${left_sep} "
else
tmux set-option -g status-left "#[bg=${dark_gray},fg=${green}]#[bg=${green},fg=${dark_gray}]#{?client_prefix,#[bg=${yellow}],} ${left_icon} #[fg=${green},bg=${bg_color}]#{?client_prefix,#[fg=${yellow}],}${left_sep}"
fi
powerbg=${bg_color}
else
tmux set-option -g status-left "#[bg=${green},fg=${dark_gray}]#{?client_prefix,#[bg=${yellow}],} ${left_icon}"
Expand Down Expand Up @@ -313,12 +329,20 @@ main()
script="#($current_dir/sys_temp.sh)"
fi

# edge styling
if $show_edge_icons; then
right_edge_icon="#[bg=${bg_color},fg=${!colors[0]}]${show_left_sep}"
background_color=${bg_color}
else
background_color=${powerbg}
fi

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=${background_color},nobold,nounderscore,noitalics]${right_sep}#[fg=${!colors[1]},bg=${!colors[0]}] $script $right_edge_icon"
else
tmux set-option -ga status-right "#{?#{==:$script,},,#[fg=${!colors[0]},nobold,nounderscore,noitalics]${right_sep}#[fg=${!colors[1]},bg=${!colors[0]}] $script }"
fi
tmux set-option -ga status-right "#{?#{==:$script,},,#[fg=${!colors[0]},nobold,nounderscore,noitalics] ${right_sep}#[fg=${!colors[1]},bg=${!colors[0]}] $script $right_edge_icon}"
fi
powerbg=${!colors[0]}
else
if $show_empty_plugins; then
Expand All @@ -327,6 +351,7 @@ main()
tmux set-option -ga status-right "#{?#{==:$script,},,#[fg=${!colors[1]},bg=${!colors[0]}] $script }"
fi
fi

done

# Window option
Expand Down