From 38b25a816d1eb6cd97ce18c52255489f64d9b014 Mon Sep 17 00:00:00 2001 From: Emil Toivainen Date: Thu, 11 Jan 2024 21:03:25 +0200 Subject: [PATCH] feat: pane enable & top/bottom --- catppuccin.tmux | 86 ++++++++++++++++---------------- pane/pane/pane_default_format.sh | 12 ----- pane/pane_default_format.sh | 9 ++-- 3 files changed, 47 insertions(+), 60 deletions(-) delete mode 100644 pane/pane/pane_default_format.sh diff --git a/catppuccin.tmux b/catppuccin.tmux index b445495..9279836 100755 --- a/catppuccin.tmux +++ b/catppuccin.tmux @@ -69,62 +69,58 @@ build_pane_format() { if [ "$pane_status_enable" = "yes" ] then - local icon="$( build_pane_icon )" - text="$text $icon" - fi + if [ "$fill" = "none" ] + then + local show_left_separator="#[fg=$thm_gray,bg=$thm_bg,nobold,nounderscore,noitalics]$pane_left_separator" + local show_number="#[fg=$thm_fg,bg=$thm_gray]$number" + local show_middle_separator="#[fg=$thm_fg,bg=$thm_gray,nobold,nounderscore,noitalics]$pane_middle_separator" + local show_text="#[fg=$thm_fg,bg=$thm_gray]$text" + local show_right_separator="#[fg=$thm_gray,bg=$thm_bg]$pane_right_separator" + fi - if [ "$fill" = "none" ] - then - local show_left_separator="#[fg=$thm_gray,bg=$thm_bg,nobold,nounderscore,noitalics]$pane_left_separator" - local show_number="#[fg=$thm_fg,bg=$thm_gray]$number" - local show_middle_separator="#[fg=$thm_fg,bg=$thm_gray,nobold,nounderscore,noitalics]$pane_middle_separator" - local show_text="#[fg=$thm_fg,bg=$thm_gray]$text" - local show_right_separator="#[fg=$thm_gray,bg=$thm_bg]$pane_right_separator" + if [ "$fill" = "all" ] + then + local show_left_separator="#[fg=$color,bg=$thm_bg,nobold,nounderscore,noitalics]$pane_left_separator" + local show_number="#[fg=$background,bg=$color]$number" + local show_middle_separator="#[fg=$background,bg=$color,nobold,nounderscore,noitalics]$pane_middle_separator" + local show_text="#[fg=$background,bg=$color]$text" + local show_right_separator="#[fg=$color,bg=$thm_bg]$pane_right_separator" + fi - fi + if [ "$fill" = "number" ] + then + local show_number="#[fg=$background,bg=$color]$number" + local show_middle_separator="#[fg=$color,bg=$background,nobold,nounderscore,noitalics]$pane_middle_separator" + local show_text="#[fg=$thm_fg,bg=$background]$text" - if [ "$fill" = "all" ] - then - local show_left_separator="#[fg=$color,bg=$thm_bg,nobold,nounderscore,noitalics]$pane_left_separator" - local show_number="#[fg=$background,bg=$color]$number" - local show_middle_separator="#[fg=$background,bg=$color,nobold,nounderscore,noitalics]$pane_middle_separator" - local show_text="#[fg=$background,bg=$color]$text" - local show_right_separator="#[fg=$color,bg=$thm_bg]$pane_right_separator" - fi + if [ "$pane_number_position" = "right" ] + then + local show_left_separator="#[fg=$background,bg=$thm_bg,nobold,nounderscore,noitalics]$pane_left_separator" + local show_right_separator="#[fg=$color,bg=$thm_bg]$pane_right_separator" + fi - if [ "$fill" = "number" ] - then - local show_number="#[fg=$background,bg=$color]$number" - local show_middle_separator="#[fg=$color,bg=$background,nobold,nounderscore,noitalics]$pane_middle_separator" - local show_text="#[fg=$thm_fg,bg=$background]$text" + if [ "$pane_number_position" = "left" ] + then + local show_right_separator="#[fg=$background,bg=$thm_bg,nobold,nounderscore,noitalics]$pane_right_separator" + local show_left_separator="#[fg=$color,bg=$thm_bg]$pane_left_separator" + fi + + fi + + local final_pane_format if [ "$pane_number_position" = "right" ] then - local show_left_separator="#[fg=$background,bg=$thm_bg,nobold,nounderscore,noitalics]$pane_left_separator" - local show_right_separator="#[fg=$color,bg=$thm_bg]$pane_right_separator" + final_pane_format="$show_left_separator$show_text$show_middle_separator$show_number$show_right_separator" fi if [ "$pane_number_position" = "left" ] then - local show_right_separator="#[fg=$background,bg=$thm_bg,nobold,nounderscore,noitalics]$pane_right_separator" - local show_left_separator="#[fg=$color,bg=$thm_bg]$pane_left_separator" + final_pane_format="$show_left_separator$show_number$show_middle_separator$show_text$show_right_separator" fi + echo "$final_pane_format" fi - - local final_pane_format - - if [ "$pane_number_position" = "right" ] - then - final_pane_format="$show_left_separator$show_text$show_middle_separator$show_number$show_right_separator" - fi - - if [ "$pane_number_position" = "left" ] - then - final_pane_format="$show_left_separator$show_number$show_middle_separator$show_text$show_right_separator" - fi - - echo "$final_pane_format" } build_window_format() { @@ -363,15 +359,17 @@ main() { set message-command-style "fg=${thm_cyan},bg=${thm_gray},align=centre" # panes + local pane_status_enable=$(get_tmux_option "@catppuccin_pane_status_enabled" "no") # yes + local pane_border_status=$(get_tmux_option "@catppuccin_pane_border_status" "top") # bottom local pane_border_style=$(get_tmux_option "@catppuccin_pane_border_style" "fg=${thm_gray}") local pane_active_border_style=$(get_tmux_option "@catppuccin_pane_active_border_style" "fg=${thm_orange}") local pane_left_separator=$(get_tmux_option "@catppuccin_pane_left_separator" "█") local pane_middle_separator=$(get_tmux_option "@catppuccin_pane_middle_separator" "█") local pane_right_separator=$(get_tmux_option "@catppuccin_pane_right_separator" "█") local pane_number_position=$(get_tmux_option "@catppuccin_pane_number_position" "left") # right, left - local pane_status_enable=$(get_tmux_option "@catppuccin_pane_status_enable" "no") - local pane_format=$( load_modules "pane_default_format") + + setw pane-border-status "$pane_border_status" setw pane-active-border-style "$pane_active_border_style" setw pane-border-style "$pane_border_style" setw pane-border-format "$pane_format" diff --git a/pane/pane/pane_default_format.sh b/pane/pane/pane_default_format.sh deleted file mode 100644 index 8e754b6..0000000 --- a/pane/pane/pane_default_format.sh +++ /dev/null @@ -1,12 +0,0 @@ -show_pane_default_format() { - local number="#{pane_index}" - local color="$thm_green" - local background="$thm_gray" - local text="$(get_tmux_option "@catppuccin_pane_default_text" "#{b:pane_current_path}")" - local fill="$(get_tmux_option "@catppuccin_pane_default_fill" "number")" # number, all, none - local active="#{pane_active}" - - local default_pane_format=$( build_pane_format "$number" "$color" "$background" "$text" "$fill") - - echo "$default_pane_format" -} diff --git a/pane/pane_default_format.sh b/pane/pane_default_format.sh index 30cbb4d..8e754b6 100644 --- a/pane/pane_default_format.sh +++ b/pane/pane_default_format.sh @@ -1,11 +1,12 @@ show_pane_default_format() { - local number="#I" - local color="$thm_blue" + local number="#{pane_index}" + local color="$thm_green" local background="$thm_gray" - local text="$(get_tmux_option "@catppuccin_pane_default_text" "#{b:pane_current_path}")" # use #W for application instead of directory + local text="$(get_tmux_option "@catppuccin_pane_default_text" "#{b:pane_current_path}")" local fill="$(get_tmux_option "@catppuccin_pane_default_fill" "number")" # number, all, none + local active="#{pane_active}" - local default_pane_format=$( build_pane_format "$number" "$color" "$background" "$text" "$fill" ) + local default_pane_format=$( build_pane_format "$number" "$color" "$background" "$text" "$fill") echo "$default_pane_format" }