feat: improve transparent background (#175)

* feat: improve transparent background

* fix: fix for config2

* chore: remove status right separator invert

* chore: update config presets in documentation
This commit is contained in:
Valentin Uveges 2024-03-28 18:55:01 +02:00 committed by GitHub
parent e2d345648c
commit a1079943b6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 82 additions and 102 deletions

View file

@ -253,14 +253,6 @@ set -g @catppuccin_status_left_separator ""
set -g @catppuccin_status_right_separator "█" set -g @catppuccin_status_right_separator "█"
``` ```
#### Set the status module right separator inverse:
```sh
set -g @catppuccin_status_right_separator_inverse "no"
```
Values:
- yes - the colors will be inverted for the right separator
- no - the colors will not be inverted for the right separator
#### Set the status connect separator: #### Set the status connect separator:
```sh ```sh
set -g @catppuccin_status_connect_separator "yes" set -g @catppuccin_status_connect_separator "yes"
@ -514,9 +506,8 @@ set -g @catppuccin_window_current_text "#{pane_current_path}"
set -g @catppuccin_status_modules_right "application session date_time" set -g @catppuccin_status_modules_right "application session date_time"
set -g @catppuccin_status_left_separator "" set -g @catppuccin_status_left_separator ""
set -g @catppuccin_status_right_separator " " set -g @catppuccin_status_right_separator " "
set -g @catppuccin_status_right_separator_inverse "yes"
set -g @catppuccin_status_fill "all" set -g @catppuccin_status_fill "all"
set -g @catppuccin_status_connect_separator "no" set -g @catppuccin_status_connect_separator "yes"
``` ```
### Config 3 ### Config 3
@ -537,7 +528,6 @@ set -g @catppuccin_window_current_text "#W"
set -g @catppuccin_status_modules_right "directory user host session" set -g @catppuccin_status_modules_right "directory user host session"
set -g @catppuccin_status_left_separator " " set -g @catppuccin_status_left_separator " "
set -g @catppuccin_status_right_separator "" set -g @catppuccin_status_right_separator ""
set -g @catppuccin_status_right_separator_inverse "no"
set -g @catppuccin_status_fill "icon" set -g @catppuccin_status_fill "icon"
set -g @catppuccin_status_connect_separator "no" set -g @catppuccin_status_connect_separator "no"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 77 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Before After
Before After

View file

@ -1,68 +1,44 @@
#!/bin/sh #!/bin/sh
build_status_module() { build_status_module() {
local index=$1 local index="$1"
local icon=$2 local icon="$2"
local color=$3 local color="$3"
local text=$4 local text="$4"
if [ "$status_fill" = "icon" ]
then
local show_left_separator="#[fg=$color,bg=$thm_gray,nobold,nounderscore,noitalics]$status_left_separator"
if [ "$status_fill" = "icon" ]; then
local show_icon="#[fg=$thm_bg,bg=$color,nobold,nounderscore,noitalics]$icon " local show_icon="#[fg=$thm_bg,bg=$color,nobold,nounderscore,noitalics]$icon "
local show_text="#[fg=$thm_fg,bg=$thm_gray] $text" local show_text="#[fg=$thm_fg,bg=$thm_gray] $text"
local show_right_separator="#[fg=$thm_gray,bg=$thm_bg,nobold,nounderscore,noitalics]$status_right_separator" if [ "$status_connect_separator" = "yes" ]; then
if [ "$status_connect_separator" = "yes" ]
then
local show_left_separator="#[fg=$color,bg=$thm_gray,nobold,nounderscore,noitalics]$status_left_separator" local show_left_separator="#[fg=$color,bg=$thm_gray,nobold,nounderscore,noitalics]$status_left_separator"
local show_right_separator="#[fg=$thm_gray,bg=$thm_gray,nobold,nounderscore,noitalics]$status_right_separator" local show_right_separator="#[fg=$thm_gray,bg=$thm_gray,nobold,nounderscore,noitalics]$status_right_separator"
else else
local show_left_separator="#[fg=$color,bg=$thm_bg,nobold,nounderscore,noitalics]$status_left_separator" local show_left_separator="#[fg=$color,bg=default,nobold,nounderscore,noitalics]$status_left_separator"
local show_right_separator="#[fg=$thm_gray,bg=$thm_bg,nobold,nounderscore,noitalics]$status_right_separator" local show_right_separator="#[fg=$thm_gray,bg=default,nobold,nounderscore,noitalics]$status_right_separator"
fi fi
fi fi
if [ "$status_fill" = "all" ] if [ "$status_fill" = "all" ]; then
then
local show_left_separator="#[fg=$color,bg=$thm_gray,nobold,nounderscore,noitalics]$status_left_separator"
local show_icon="#[fg=$thm_bg,bg=$color,nobold,nounderscore,noitalics]$icon " local show_icon="#[fg=$thm_bg,bg=$color,nobold,nounderscore,noitalics]$icon "
local show_text="#[fg=$thm_bg,bg=$color]$text" local show_text="#[fg=$thm_bg,bg=$color]$text"
local show_right_separator="#[fg=$color,bg=$thm_gray,nobold,nounderscore,noitalics]$status_right_separator" if [ "$status_connect_separator" = "yes" ]; then
if [ "$status_connect_separator" = "yes" ]
then
local show_left_separator="#[fg=$color,nobold,nounderscore,noitalics]$status_left_separator" local show_left_separator="#[fg=$color,nobold,nounderscore,noitalics]$status_left_separator"
local show_right_separator="#[fg=$color,bg=$color,nobold,nounderscore,noitalics]$status_right_separator" local show_right_separator="#[fg=$color,bg=$color,nobold,nounderscore,noitalics]$status_right_separator"
else else
local show_left_separator="#[fg=$color,bg=$thm_bg,nobold,nounderscore,noitalics]$status_left_separator" local show_left_separator="#[fg=$color,bg=default,nobold,nounderscore,noitalics]$status_left_separator"
local show_right_separator="#[fg=$color,bg=$thm_bg,nobold,nounderscore,noitalics]$status_right_separator" local show_right_separator="#[fg=$color,bg=default,nobold,nounderscore,noitalics]$status_right_separator"
fi fi
fi fi
if [ "$status_right_separator_inverse" = "yes" ] if [ $(($index)) -eq 0 ]; then
then local show_left_separator="#[fg=$color,bg=default,nobold,nounderscore,noitalics]$status_left_separator"
if [ "$status_connect_separator" = "yes" ]
then
local show_right_separator="#[fg=$thm_gray,bg=$color,nobold,nounderscore,noitalics]$status_right_separator"
else
local show_right_separator="#[fg=$thm_bg,bg=$color,nobold,nounderscore,noitalics]$status_right_separator"
fi
fi
if [ $(($index)) -eq 0 ]
then
local show_left_separator="#[fg=$color,bg=$thm_bg,nobold,nounderscore,noitalics]$status_left_separator"
fi fi
echo "$show_left_separator$show_icon$show_text$show_right_separator" echo "$show_left_separator$show_icon$show_text$show_right_separator"
} }

View file

@ -1,67 +1,90 @@
#!/bin/sh #!/bin/sh
build_window_format() { build_window_format() {
local number=$1 local number="$1"
local color=$2 local color="$2"
local background=$3 local background="$3"
local text=$4 local text="$4"
local fill=$5 local fill="$5"
if [ "$window_status_enable" = "yes" ] if [ "$window_status_enable" = "yes" ]; then
then
local icon="$(build_window_icon)" local icon="$(build_window_icon)"
text="$text$icon" text="$text$icon"
fi fi
if [ "$fill" = "none" ] if [ "$fill" = "none" ]; then
then
local show_left_separator="#[fg=$thm_gray,bg=$thm_bg,nobold,nounderscore,noitalics]$window_left_separator"
local show_number="#[fg=$thm_fg,bg=$thm_gray]$number" 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" local show_middle_separator="#[fg=$thm_fg,bg=$thm_gray,nobold,nounderscore,noitalics]$window_middle_separator"
local show_text="#[fg=$thm_fg,bg=$thm_gray]$text" local show_text="#[fg=$thm_fg,bg=$thm_gray]$text"
if [ "$status_connect_separator" = "yes" ]; then
local show_left_separator="#[fg=$thm_gray,bg=$thm_bg,nobold,nounderscore,noitalics]$window_left_separator"
local show_right_separator="#[fg=$thm_gray,bg=$thm_bg]$window_right_separator" local show_right_separator="#[fg=$thm_gray,bg=$thm_bg]$window_right_separator"
else
local show_left_separator="#[fg=$thm_gray,bg=default,nobold,nounderscore,noitalics]$window_left_separator"
local show_right_separator="#[fg=$thm_gray,bg=default]$window_right_separator"
fi fi
if [ "$fill" = "all" ] fi
then
local show_left_separator="#[fg=$color,bg=$thm_bg,nobold,nounderscore,noitalics]$window_left_separator" if [ "$fill" = "all" ]; then
local show_number="#[fg=$background,bg=$color]$number" local show_number="#[fg=$background,bg=$color]$number"
local show_middle_separator="#[fg=$background,bg=$color,nobold,nounderscore,noitalics]$window_middle_separator" local show_middle_separator="#[fg=$background,bg=$color,nobold,nounderscore,noitalics]$window_middle_separator"
local show_text="#[fg=$background,bg=$color]$text" local show_text="#[fg=$background,bg=$color]$text"
if [ "$status_connect_separator" = "yes" ]; then
local show_left_separator="#[fg=$color,bg=$thm_bg,nobold,nounderscore,noitalics]$window_left_separator"
local show_right_separator="#[fg=$color,bg=$thm_bg]$window_right_separator" local show_right_separator="#[fg=$color,bg=$thm_bg]$window_right_separator"
else
local show_left_separator="#[fg=$color,bg=default,nobold,nounderscore,noitalics]$window_left_separator"
local show_right_separator="#[fg=$color,bg=default]$window_right_separator"
fi fi
if [ "$fill" = "number" ] fi
then
if [ "$fill" = "number" ]; then
local show_number="#[fg=$background,bg=$color]$number" local show_number="#[fg=$background,bg=$color]$number"
local show_middle_separator="#[fg=$color,bg=$background,nobold,nounderscore,noitalics]$window_middle_separator" local show_middle_separator="#[fg=$color,bg=$background,nobold,nounderscore,noitalics]$window_middle_separator"
local show_text="#[fg=$thm_fg,bg=$background]$text" local show_text="#[fg=$thm_fg,bg=$background]$text"
if [ "$window_number_position" = "right" ] if [ "$window_number_position" = "right" ]; then
then if [ "$status_connect_separator" = "yes" ]; then
local show_left_separator="#[fg=$background,bg=$thm_bg,nobold,nounderscore,noitalics]$window_left_separator" local show_left_separator="#[fg=$background,bg=$thm_bg,nobold,nounderscore,noitalics]$window_left_separator"
local show_right_separator="#[fg=$color,bg=$thm_bg]$window_right_separator" local show_right_separator="#[fg=$color,bg=$thm_bg]$window_right_separator"
else
local show_left_separator="#[fg=$background,bg=default,nobold,nounderscore,noitalics]$window_left_separator"
local show_right_separator="#[fg=$color,bg=default]$window_right_separator"
fi
fi fi
if [ "$window_number_position" = "left" ] if [ "$window_number_position" = "left" ]; then
then if [ "$status_connect_separator" = "yes" ]; then
local show_right_separator="#[fg=$background,bg=$thm_bg,nobold,nounderscore,noitalics]$window_right_separator" local show_right_separator="#[fg=$background,bg=$thm_bg,nobold,nounderscore,noitalics]$window_right_separator"
local show_left_separator="#[fg=$color,bg=$thm_bg]$window_left_separator" local show_left_separator="#[fg=$color,bg=$thm_bg]$window_left_separator"
else
local show_right_separator="#[fg=$background,bg=default,nobold,nounderscore,noitalics]$window_right_separator"
local show_left_separator="#[fg=$color,bg=default]$window_left_separator"
fi
fi fi
fi fi
local final_window_format local final_window_format
if [ "$window_number_position" = "right" ] if [ "$window_number_position" = "right" ]; then
then
final_window_format="$show_left_separator$show_text$show_middle_separator$show_number$show_right_separator" final_window_format="$show_left_separator$show_text$show_middle_separator$show_number$show_right_separator"
fi fi
if [ "$window_number_position" = "left" ] if [ "$window_number_position" = "left" ]; then
then
final_window_format="$show_left_separator$show_number$show_middle_separator$show_text$show_right_separator" final_window_format="$show_left_separator$show_number$show_middle_separator$show_text$show_right_separator"
fi fi
@ -78,8 +101,7 @@ build_window_icon() {
local custom_icon_window_activity=$(get_tmux_option "@catppuccin_icon_window_activity" "󱅫") local custom_icon_window_activity=$(get_tmux_option "@catppuccin_icon_window_activity" "󱅫")
local custom_icon_window_bell=$(get_tmux_option "@catppuccin_icon_window_bell" "󰂞") local custom_icon_window_bell=$(get_tmux_option "@catppuccin_icon_window_bell" "󰂞")
if [ "$window_status_icon_enable" = "yes" ] if [ "$window_status_icon_enable" = "yes" ]; then
then
# #!~[*-]MZ # #!~[*-]MZ
local show_window_status="" local show_window_status=""
show_window_status+="#{?window_activity_flag, ${custom_icon_window_activity},}" show_window_status+="#{?window_activity_flag, ${custom_icon_window_activity},}"
@ -92,8 +114,7 @@ build_window_icon() {
fi fi
if [ "$window_status_icon_enable" = "no" ] if [ "$window_status_icon_enable" = "no" ]; then
then
local show_window_status=" #F" local show_window_status=" #F"
fi fi

View file

@ -10,7 +10,6 @@ source "${PLUGIN_DIR}/builder/pane_builder.sh"
source "${PLUGIN_DIR}/utils/tmux_utils.sh" source "${PLUGIN_DIR}/utils/tmux_utils.sh"
source "${PLUGIN_DIR}/utils/module_utils.sh" source "${PLUGIN_DIR}/utils/module_utils.sh"
main() { main() {
# Aggregate all commands in one array # Aggregate all commands in one array
local tmux_commands=() local tmux_commands=()
@ -46,12 +45,10 @@ main() {
set status-justify "$status_justify" set status-justify "$status_justify"
local status_background=$(get_tmux_option "@catppuccin_status_background" "theme") local status_background=$(get_tmux_option "@catppuccin_status_background" "theme")
if [ "${status_background}" = "theme" ]; if [ "${status_background}" = "theme" ]; then
then
set status-bg "${thm_bg}" set status-bg "${thm_bg}"
else else
if [ "${status_background}" = "default" ] if [ "${status_background}" = "default" ]; then
then
set status-style bg=default set status-style bg=default
else else
set status-bg "${status_background}" set status-bg "${status_background}"
@ -61,7 +58,6 @@ main() {
set status-left-length "100" set status-left-length "100"
set status-right-length "100" set status-right-length "100"
# messages # messages
set message-style "fg=${thm_cyan},bg=${thm_gray},align=centre" set message-style "fg=${thm_cyan},bg=${thm_gray},align=centre"
set message-command-style "fg=${thm_cyan},bg=${thm_gray},align=centre" set message-command-style "fg=${thm_cyan},bg=${thm_gray},align=centre"
@ -70,7 +66,7 @@ main() {
local pane_status_enable=$(get_tmux_option "@catppuccin_pane_status_enabled" "no") # yes local pane_status_enable=$(get_tmux_option "@catppuccin_pane_status_enabled" "no") # yes
local pane_border_status=$(get_tmux_option "@catppuccin_pane_border_status" "off") # bottom local pane_border_status=$(get_tmux_option "@catppuccin_pane_border_status" "off") # bottom
local pane_border_style=$(get_tmux_option "@catppuccin_pane_border_style" "fg=${thm_gray}") local pane_border_style=$(get_tmux_option "@catppuccin_pane_border_style" "fg=${thm_gray}")
local pane_active_border_style=$(\ local pane_active_border_style=$(
get_tmux_option "@catppuccin_pane_active_border_style" \ get_tmux_option "@catppuccin_pane_active_border_style" \
"#{?pane_in_mode,fg=${thm_yellow},#{?pane_synchronized,fg=${thm_magenta},fg=${thm_orange}}}" "#{?pane_in_mode,fg=${thm_yellow},#{?pane_synchronized,fg=${thm_magenta},fg=${thm_orange}}}"
) )
@ -89,9 +85,6 @@ main() {
local window_status_separator=$(get_tmux_option "@catppuccin_window_separator" "") local window_status_separator=$(get_tmux_option "@catppuccin_window_separator" "")
setw window-status-separator "$window_status_separator" setw window-status-separator "$window_status_separator"
setw window-status-activity-style "fg=${thm_fg},bg=${thm_bg},none"
setw window-status-style "fg=${thm_fg},bg=${thm_bg},none"
local window_left_separator=$(get_tmux_option "@catppuccin_window_left_separator" "█") local window_left_separator=$(get_tmux_option "@catppuccin_window_left_separator" "█")
local window_right_separator=$(get_tmux_option "@catppuccin_window_right_separator" "█") local window_right_separator=$(get_tmux_option "@catppuccin_window_right_separator" "█")
local window_middle_separator=$(get_tmux_option "@catppuccin_window_middle_separator" "█ ") local window_middle_separator=$(get_tmux_option "@catppuccin_window_middle_separator" "█ ")