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 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:
```sh
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_left_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_connect_separator "no"
set -g @catppuccin_status_connect_separator "yes"
```
### 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_left_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_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
build_status_module() {
local index=$1
local icon=$2
local color=$3
local text=$4
if [ "$status_fill" = "icon" ]
then
local show_left_separator="#[fg=$color,bg=$thm_gray,nobold,nounderscore,noitalics]$status_left_separator"
local index="$1"
local icon="$2"
local color="$3"
local text="$4"
if [ "$status_fill" = "icon" ]; then
local show_icon="#[fg=$thm_bg,bg=$color,nobold,nounderscore,noitalics]$icon "
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_right_separator="#[fg=$thm_gray,bg=$thm_gray,nobold,nounderscore,noitalics]$status_right_separator"
else
local show_left_separator="#[fg=$color,bg=$thm_bg,nobold,nounderscore,noitalics]$status_left_separator"
local show_right_separator="#[fg=$thm_gray,bg=$thm_bg,nobold,nounderscore,noitalics]$status_right_separator"
local show_left_separator="#[fg=$color,bg=default,nobold,nounderscore,noitalics]$status_left_separator"
local show_right_separator="#[fg=$thm_gray,bg=default,nobold,nounderscore,noitalics]$status_right_separator"
fi
fi
if [ "$status_fill" = "all" ]
then
local show_left_separator="#[fg=$color,bg=$thm_gray,nobold,nounderscore,noitalics]$status_left_separator"
if [ "$status_fill" = "all" ]; then
local show_icon="#[fg=$thm_bg,bg=$color,nobold,nounderscore,noitalics]$icon "
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_right_separator="#[fg=$color,bg=$color,nobold,nounderscore,noitalics]$status_right_separator"
else
local show_left_separator="#[fg=$color,bg=$thm_bg,nobold,nounderscore,noitalics]$status_left_separator"
local show_right_separator="#[fg=$color,bg=$thm_bg,nobold,nounderscore,noitalics]$status_right_separator"
local show_left_separator="#[fg=$color,bg=default,nobold,nounderscore,noitalics]$status_left_separator"
local show_right_separator="#[fg=$color,bg=default,nobold,nounderscore,noitalics]$status_right_separator"
fi
fi
if [ "$status_right_separator_inverse" = "yes" ]
then
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"
if [ $(($index)) -eq 0 ]; then
local show_left_separator="#[fg=$color,bg=default,nobold,nounderscore,noitalics]$status_left_separator"
fi
echo "$show_left_separator$show_icon$show_text$show_right_separator"
}

View file

@ -1,67 +1,90 @@
#!/bin/sh
build_window_format() {
local number=$1
local color=$2
local background=$3
local text=$4
local fill=$5
local number="$1"
local color="$2"
local background="$3"
local text="$4"
local fill="$5"
if [ "$window_status_enable" = "yes" ]
then
local icon="$( build_window_icon )"
if [ "$window_status_enable" = "yes" ]; then
local icon="$(build_window_icon)"
text="$text$icon"
fi
if [ "$fill" = "none" ]
then
local show_left_separator="#[fg=$thm_gray,bg=$thm_bg,nobold,nounderscore,noitalics]$window_left_separator"
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"
local show_text="#[fg=$thm_fg,bg=$thm_gray]$text"
local show_right_separator="#[fg=$thm_gray,bg=$thm_bg]$window_right_separator"
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"
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" ]
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_middle_separator="#[fg=$background,bg=$color,nobold,nounderscore,noitalics]$window_middle_separator"
local show_text="#[fg=$background,bg=$color]$text"
local show_right_separator="#[fg=$color,bg=$thm_bg]$window_right_separator"
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"
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" ]
then
if [ "$fill" = "number" ]; then
local show_number="#[fg=$background,bg=$color]$number"
local show_middle_separator="#[fg=$color,bg=$background,nobold,nounderscore,noitalics]$window_middle_separator"
local show_text="#[fg=$thm_fg,bg=$background]$text"
if [ "$window_number_position" = "right" ]
then
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"
if [ "$window_number_position" = "right" ]; then
if [ "$status_connect_separator" = "yes" ]; then
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"
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
if [ "$window_number_position" = "left" ]
then
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"
if [ "$window_number_position" = "left" ]; then
if [ "$status_connect_separator" = "yes" ]; then
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"
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
local final_window_format
if [ "$window_number_position" = "right" ]
then
if [ "$window_number_position" = "right" ]; then
final_window_format="$show_left_separator$show_text$show_middle_separator$show_number$show_right_separator"
fi
if [ "$window_number_position" = "left" ]
then
if [ "$window_number_position" = "left" ]; then
final_window_format="$show_left_separator$show_number$show_middle_separator$show_text$show_right_separator"
fi
@ -78,8 +101,7 @@ build_window_icon() {
local custom_icon_window_activity=$(get_tmux_option "@catppuccin_icon_window_activity" "󱅫")
local custom_icon_window_bell=$(get_tmux_option "@catppuccin_icon_window_bell" "󰂞")
if [ "$window_status_icon_enable" = "yes" ]
then
if [ "$window_status_icon_enable" = "yes" ]; then
# #!~[*-]MZ
local show_window_status=""
show_window_status+="#{?window_activity_flag, ${custom_icon_window_activity},}"
@ -92,8 +114,7 @@ build_window_icon() {
fi
if [ "$window_status_icon_enable" = "no" ]
then
if [ "$window_status_icon_enable" = "no" ]; then
local show_window_status=" #F"
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/module_utils.sh"
main() {
# Aggregate all commands in one array
local tmux_commands=()
@ -29,14 +28,14 @@ main() {
# shellcheck source=catppuccin-frappe.tmuxtheme
# https://github.com/dylanaraps/pure-sh-bible#parsing-a-keyval-file
while IFS='=' read -r key val; do
# Skip over lines containing comments.
# (Lines starting with '#').
[ "${key##\#*}" ] || continue
# Skip over lines containing comments.
# (Lines starting with '#').
[ "${key##\#*}" ] || continue
# '$key' stores the key.
# '$val' stores the value.
eval "local $key"="$val"
done < "${PLUGIN_DIR}/catppuccin-${theme}.tmuxtheme"
# '$key' stores the key.
# '$val' stores the value.
eval "local $key"="$val"
done <"${PLUGIN_DIR}/catppuccin-${theme}.tmuxtheme"
# status general
local status_default=$(get_tmux_option "@catppuccin_status_default" "on")
@ -46,12 +45,10 @@ main() {
set status-justify "$status_justify"
local status_background=$(get_tmux_option "@catppuccin_status_background" "theme")
if [ "${status_background}" = "theme" ];
then
if [ "${status_background}" = "theme" ]; then
set status-bg "${thm_bg}"
else
if [ "${status_background}" = "default" ]
then
if [ "${status_background}" = "default" ]; then
set status-style bg=default
else
set status-bg "${status_background}"
@ -61,7 +58,6 @@ main() {
set status-left-length "100"
set status-right-length "100"
# messages
set message-style "fg=${thm_cyan},bg=${thm_gray},align=centre"
set message-command-style "fg=${thm_cyan},bg=${thm_gray},align=centre"
@ -70,9 +66,9 @@ main() {
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_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" \
"#{?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}}}"
)
local pane_left_separator=$(get_tmux_option "@catppuccin_pane_left_separator" "█")
local pane_middle_separator=$(get_tmux_option "@catppuccin_pane_middle_separator" "█")
@ -89,14 +85,11 @@ main() {
local window_status_separator=$(get_tmux_option "@catppuccin_window_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_right_separator=$(get_tmux_option "@catppuccin_window_right_separator" "█")
local window_middle_separator=$(get_tmux_option "@catppuccin_window_middle_separator" "█ ")
local window_number_position=$(get_tmux_option "@catppuccin_window_number_position" "left") # right, left
local window_status_enable=$(get_tmux_option "@catppuccin_window_status_enable" "no") # right, left
local window_status_enable=$(get_tmux_option "@catppuccin_window_status_enable" "no") # right, left
local window_format=$(load_modules "window_default_format" "$modules_custom_path" "$modules_window_path")
setw window-status-format "$window_format"