feat: compact mode option

This commit is contained in:
Mike 2024-04-02 11:09:50 +00:00 committed by Abhishek Keshri
parent 7f36148dab
commit 54f87ee13e
2 changed files with 15 additions and 6 deletions

View file

@ -134,6 +134,9 @@ set -g @tmux2k-theme 'onedark'
# to show icons only # to show icons only
set -g @tmux2k-icons-only true set -g @tmux2k-icons-only true
# to enable compact window tab size
set -g @tmux2k-compact-windows true
# to customize colors # to customize colors
set -g @tmux2k-text '#cdcdcd' # change text to white set -g @tmux2k-text '#cdcdcd' # change text to white
set -g @tmux2k-bg-main '#ffffff' # change bg to white set -g @tmux2k-bg-main '#ffffff' # change bg to white

View file

@ -17,6 +17,7 @@ IFS=' ' read -r -a lplugins <<<"$(get_tmux_option '@tmux2k-left-plugins' 'git cp
IFS=' ' read -r -a rplugins <<<"$(get_tmux_option '@tmux2k-right-plugins' 'battery network time')" IFS=' ' read -r -a rplugins <<<"$(get_tmux_option '@tmux2k-right-plugins' 'battery network time')"
theme=$(get_tmux_option "@tmux2k-theme" 'default') theme=$(get_tmux_option "@tmux2k-theme" 'default')
icons_only=$(get_tmux_option "@tmux2k-icons-only" false) icons_only=$(get_tmux_option "@tmux2k-icons-only" false)
compact=$(get_tmux_option "@tmux2k-compact-windows" false)
text=$(get_tmux_option "@tmux2k-text" '#282a36') text=$(get_tmux_option "@tmux2k-text" '#282a36')
bg_main=$(get_tmux_option "@tmux2k-bg-main" '#15152a') bg_main=$(get_tmux_option "@tmux2k-bg-main" '#15152a')
@ -203,6 +204,11 @@ window_list() {
wbg=${!colors[0]} wbg=${!colors[0]}
wfg=${!colors[1]} wfg=${!colors[1]}
spacer=" "
if $compact; then
spacer=""
fi
if $show_flags; then if $show_flags; then
flags="#{?window_flags,#[fg=${light_red}]#{window_flags},}" flags="#{?window_flags,#[fg=${light_red}]#{window_flags},}"
current_flags="#{?window_flags,#[fg=${light_green}]#{window_flags},}" current_flags="#{?window_flags,#[fg=${light_green}]#{window_flags},}"
@ -210,17 +216,17 @@ window_list() {
if $show_powerline; then if $show_powerline; then
tmux set-window-option -g window-status-current-format \ tmux set-window-option -g window-status-current-format \
"#[fg=${wfg},bg=${wbg}]${wl_sep}#[bg=${wfg}]${current_flags}#[fg=${wbg}] #I:#W #[fg=${wfg},bg=${wbg}]${wr_sep}" "#[fg=${wfg},bg=${wbg}]${wl_sep}#[bg=${wfg}]${current_flags}#[fg=${wbg}]${spacer}#I:#W${spacer}#[fg=${wfg},bg=${wbg}]${wr_sep}"
tmux set-window-option -g window-status-format \ tmux set-window-option -g window-status-format \
"#[fg=${bg_alt},bg=${wbg}]${wl_sep}#[bg=${bg_alt}]${flags}#[fg=${white}] #I:#W #[fg=${bg_alt},bg=${wbg}]${wr_sep}" "#[fg=${bg_alt},bg=${wbg}]${wl_sep}#[bg=${bg_alt}]${flags}#[fg=${white}]${spacer}#I:#W${spacer}#[fg=${bg_alt},bg=${wbg}]${wr_sep}"
else else
tmux set-window-option -g window-status-current-format "#[fg=${wbg},bg=${wfg}] #I:#W ${current_flags} " tmux set-window-option -g window-status-current-format "#[fg=${wbg},bg=${wfg}] #I:#W${spacer}${current_flags} "
tmux set-window-option -g window-status-format "#[fg=${white},bg=${bg_alt}] #I:#W ${flags} " tmux set-window-option -g window-status-format "#[fg=${white},bg=${bg_alt}] #I:#W${spacer}${flags} "
fi fi
if $icons_only; then if $icons_only; then
tmux set-window-option -g window-status-current-format "#[fg=${wbg},bg=${wfg}] #I:#W " tmux set-window-option -g window-status-current-format "#[fg=${wbg},bg=${wfg}]${spacer}#I:#W${spacer}"
tmux set-window-option -g window-status-format "#[fg=${white},bg=${wfg}] #I:#W " tmux set-window-option -g window-status-format "#[fg=${white},bg=${wfg}]${spacer}#I:#W${spacer}"
fi fi
} }