From 8276c5a5e33dbbbae3d370db2f6129e20b402f8a Mon Sep 17 00:00:00 2001 From: Mikel Bravo Date: Sat, 7 Sep 2024 12:03:44 +0200 Subject: [PATCH] feat(status): window specific separator config (#198) * feat(window-builder): get window separator based on window type * feat(window-format): send window type param to builder fix: apply suggestions from code review * feat(readme): add window type separator options --- README.md | 6 ++++++ builder/window_builder.sh | 13 +++++++++++++ window/window_current_format.sh | 2 +- window/window_default_format.sh | 2 +- 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index dfee770..001493a 100644 --- a/README.md +++ b/README.md @@ -189,6 +189,12 @@ Values: set -g @catppuccin_window_current_text "#{b:pane_current_path}" # use "#W" for application instead of directory ``` +#### Override the window current separators +```sh +set -g @catppuccin_window_current_left_separator "" +set -g @catppuccin_window_current_middle_separator "█" +set -g @catppuccin_window_current_right_separator "" +``` ### Pane #### Set the pane border style: diff --git a/builder/window_builder.sh b/builder/window_builder.sh index aa3f639..2211009 100644 --- a/builder/window_builder.sh +++ b/builder/window_builder.sh @@ -9,6 +9,7 @@ build_window_format() { local background="$3" local text="$4" local fill="$5" + local window_type="$6" # NOTE: For backwards compatibility remove before 1.0.0 and update default for # `@catppuccin_window_status` @@ -38,6 +39,18 @@ build_window_format() { text="$text$icon" fi + if [ "$window_type" = "current" ]; then + add_tmux_batch_option "@catppuccin_window_current_left_separator" + add_tmux_batch_option "@catppuccin_window_current_middle_separator" + add_tmux_batch_option "@catppuccin_window_current_right_separator" + + run_tmux_batch_commands + + window_left_separator=$(get_tmux_batch_option "@catppuccin_window_current_left_separator" "$window_left_separator") + window_middle_separator=$(get_tmux_batch_option "@catppuccin_window_current_middle_separator" "$window_middle_separator") + window_right_separator=$(get_tmux_batch_option "@catppuccin_window_current_right_separator" "$window_right_separator") + fi + if [ "$fill" = "none" ]; then local show_number="#[fg=$thm_fg,bg=$thm_gray]$number" local show_middle_separator="#[fg=$thm_fg,bg=$thm_gray,nobold,nounderscore,noitalics]$window_middle_separator" diff --git a/window/window_current_format.sh b/window/window_current_format.sh index 511d0c3..6634f48 100644 --- a/window/window_current_format.sh +++ b/window/window_current_format.sh @@ -18,7 +18,7 @@ show_window_current_format() { text="$(get_tmux_batch_option "@catppuccin_window_current_text" "#{b:pane_current_path}")" # use #W for application instead of directory fill="$(get_tmux_batch_option "@catppuccin_window_current_fill" "number")" # number, all, none - current_window_format=$(build_window_format "$number" "$color" "$background" "$text" "$fill") + current_window_format=$(build_window_format "$number" "$color" "$background" "$text" "$fill" "current") echo "$current_window_format" } diff --git a/window/window_default_format.sh b/window/window_default_format.sh index e426181..c749f2a 100644 --- a/window/window_default_format.sh +++ b/window/window_default_format.sh @@ -18,7 +18,7 @@ show_window_default_format() { text="$(get_tmux_batch_option "@catppuccin_window_default_text" "#{b:pane_current_path}")" # use #W for application instead of directory fill="$(get_tmux_batch_option "@catppuccin_window_default_fill" "number")" # number, all, none - default_window_format=$(build_window_format "$number" "$color" "$background" "$text" "$fill") + default_window_format=$(build_window_format "$number" "$color" "$background" "$text" "$fill" "default") echo "$default_window_format" }