diff --git a/README.md b/README.md index fb2a082..643e583 100644 --- a/README.md +++ b/README.md @@ -202,6 +202,7 @@ Values: - yes - the background color of the separator will not blend in with the brackground color of tmux - no - the background color of the separator will blend in with the brackground color of tmux + #### Set the status module color fill: ```sh set -g @catppuccin_status_fill "icon" diff --git a/catppuccin.tmux b/catppuccin.tmux index e49449d..09db0ea 100755 --- a/catppuccin.tmux +++ b/catppuccin.tmux @@ -57,19 +57,19 @@ build_window_icon() { } 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 )" - text="$text $icon" + text="$text $icon" fi - if [ "$fill" = "none" ] + if [ "$fill" = "none" ] 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" @@ -79,7 +79,7 @@ build_window_format() { fi - if [ "$fill" = "all" ] + if [ "$fill" = "all" ] then local show_left_separator="#[fg=$color,bg=$thm_bg,nobold,nounderscore,noitalics]$window_left_separator" local show_number="#[fg=$background,bg=$color]$number" @@ -88,8 +88,8 @@ build_window_format() { local show_right_separator="#[fg=$color,bg=$thm_bg]$window_right_separator" fi - - if [ "$fill" = "number" ] + + 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" @@ -125,35 +125,66 @@ build_window_format() { } build_status_module() { - local index="$1" - local icon="$2" - local color="$3" - local text="$4" - - if [ "$index" -eq 0 ] || [ "$status_connect_separator" = "no" ] - then - local show_left_separator="#[fg=$color,bg=$thm_bg,nobold,nounderscore,noitalics]$status_left_separator" - else - local show_left_separator="#[fg=$color,bg=$thm_gray,nobold,nounderscore,noitalics]$status_left_separator" - fi + 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 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 + 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" + fi + fi if [ "$status_fill" = "all" ] 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_text="#[fg=$thm_bg,bg=$color]$text" - local show_right_separator="#[fg=$color,bg=$thm_bg,nobold,nounderscore,noitalics]$status_right_separator" + + local show_right_separator="#[fg=$color,bg=$thm_gray,nobold,nounderscore,noitalics]$status_right_separator" + + 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" + fi + fi if [ "$status_right_separator_inverse" = "yes" ] then - local show_right_separator="#[fg=$thm_bg,bg=$color,nobold,nounderscore,noitalics]$status_right_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 echo "$show_left_separator$show_icon$show_text$show_right_separator" @@ -161,7 +192,7 @@ build_status_module() { load_modules() { local modules_list=$1 - + local modules_custom_path=$PLUGIN_DIR/custom local modules_status_path=$PLUGIN_DIR/status local modules_window_path=$PLUGIN_DIR/window @@ -259,11 +290,11 @@ main() { # --------=== Statusline - 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_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_format=$( load_modules "window_default_format") local window_current_format=$( load_modules "window_current_format") @@ -271,13 +302,13 @@ main() { setw window-status-format "$window_format" setw window-status-current-format "$window_current_format" - local status_left_separator="$(get_tmux_option "@catppuccin_status_left_separator" "")" - local status_right_separator="$(get_tmux_option "@catppuccin_status_right_separator" "█")" - local status_right_separator_inverse="$(get_tmux_option "@catppuccin_status_right_separator_inverse" "no")" - local status_connect_separator="$(get_tmux_option "@catppuccin_status_connect_separator" "yes")" - local status_fill="$(get_tmux_option "@catppuccin_status_fill" "icon")" + local status_left_separator=$(get_tmux_option "@catppuccin_status_left_separator" "") + local status_right_separator=$(get_tmux_option "@catppuccin_status_right_separator" "█") + local status_right_separator_inverse=$(get_tmux_option "@catppuccin_status_right_separator_inverse" "no") + local status_connect_separator=$(get_tmux_option "@catppuccin_status_connect_separator" "yes") + local status_fill=$(get_tmux_option "@catppuccin_status_fill" "icon") - local status_modules="$(get_tmux_option "@catppuccin_status_modules" "application session")" + local status_modules=$(get_tmux_option "@catppuccin_status_modules" "application session") local loaded_modules=$( load_modules "$status_modules") set status-left "" diff --git a/status/application.sh b/status/application.sh index 5427479..0a99a59 100644 --- a/status/application.sh +++ b/status/application.sh @@ -1,10 +1,10 @@ show_application() { - local index=$1 - local icon="$(get_tmux_option "@catppuccin_application_icon" "")" - local color="$(get_tmux_option "@catppuccin_application_color" "$thm_pink")" - local text="$(get_tmux_option "@catppuccin_application_text" "#W")" + local index=$1 + local icon=$(get_tmux_option "@catppuccin_application_icon" "") + local color=$(get_tmux_option "@catppuccin_application_color" "$thm_pink") + local text=$(get_tmux_option "@catppuccin_application_text" "#W") local module=$( build_status_module "$index" "$icon" "$color" "$text" ) - echo $module + echo $module } diff --git a/status/battery.sh b/status/battery.sh index 2c2add1..ecd74a7 100644 --- a/status/battery.sh +++ b/status/battery.sh @@ -12,12 +12,12 @@ show_battery() { tmux set-option -g @batt_icon_status_discharging '󰂃' tmux set-option -g @batt_icon_status_unknown '󰂑' - local index=$1 - local icon="$(get_tmux_option "@catppuccin_battery_icon" "#{battery_icon}")" - local color="$(get_tmux_option "@catppuccin_battery_color" "$thm_yellow")" - local text="$(get_tmux_option "@catppuccin_battery_text" "#{battery_percentage}")" + local index=$1 + local icon=$(get_tmux_option "@catppuccin_battery_icon" "#{battery_icon}") + local color=$(get_tmux_option "@catppuccin_battery_color" "$thm_yellow") + local text=$(get_tmux_option "@catppuccin_battery_text" "#{battery_percentage}") local module=$( build_status_module "$index" "$icon" "$color" "$text" ) - echo $module + echo $module } diff --git a/status/date_time.sh b/status/date_time.sh index 858639a..54070a8 100644 --- a/status/date_time.sh +++ b/status/date_time.sh @@ -1,11 +1,11 @@ show_date_time() { - local index=$1 + local index=$1 local icon="$(get_tmux_option "@catppuccin_date_time_icon" "󰃰")" local color="$(get_tmux_option "@catppuccin_date_time_color" "$thm_blue")" local text="$(get_tmux_option "@catppuccin_date_time_text" "%Y-%m-%d %H:%M")" local module=$( build_status_module "$index" "$icon" "$color" "$text" ) - echo $module + echo $module } diff --git a/status/directory.sh b/status/directory.sh index 5d382f8..924915e 100644 --- a/status/directory.sh +++ b/status/directory.sh @@ -1,10 +1,10 @@ show_directory() { - local index=$1 - local icon="$(get_tmux_option "@catppuccin_directory_icon" "")" - local color="$(get_tmux_option "@catppuccin_directory_color" "$thm_pink")" - local text="$(get_tmux_option "@catppuccin_directory_text" "#{b:pane_current_path}")" + local index=$1 + local icon=$(get_tmux_option "@catppuccin_directory_icon" "") + local color=$(get_tmux_option "@catppuccin_directory_color" "$thm_pink") + local text=$(get_tmux_option "@catppuccin_directory_text" "#{b:pane_current_path}") local module=$( build_status_module "$index" "$icon" "$color" "$text" ) - echo $module + echo $module } diff --git a/status/host.sh b/status/host.sh index 73d8393..4c143c4 100644 --- a/status/host.sh +++ b/status/host.sh @@ -1,10 +1,10 @@ show_host() { - local index=$1 - local icon="$(get_tmux_option "@catppuccin_host_icon" "󰒋")" - local color="$(get_tmux_option "@catppuccin_host_color" "$thm_magenta")" - local text="$(get_tmux_option "@catppuccin_host_text" "#H")" + local index=$1 + local icon=$(get_tmux_option "@catppuccin_host_icon" "󰒋") + local color=$(get_tmux_option "@catppuccin_host_color" "$thm_magenta") + local text=$(get_tmux_option "@catppuccin_host_text" "#H") local module=$( build_status_module "$index" "$icon" "$color" "$text" ) - echo $module + echo $module } diff --git a/status/session.sh b/status/session.sh index 039c779..a2953ee 100644 --- a/status/session.sh +++ b/status/session.sh @@ -1,33 +1,10 @@ show_session() { - local index=$1 - local icon="$(get_tmux_option "@catppuccin_session_icon" "")" - local text="$(get_tmux_option "@catppuccin_session_text" "#S")" + local index=$1 + local icon=$(get_tmux_option "@catppuccin_session_icon" "") + local color=$(get_tmux_option "@catppuccin_session_color" "#{?client_prefix,$thm_red,$thm_green}") + local text=$(get_tmux_option "@catppuccin_session_text" "#S") - if [[ $index -eq 0 || $status_connect_separator == "no" ]] - then - local show_left_separator="#[fg=$thm_green]#[bg=$thm_bg]#{?client_prefix,#[fg=$thm_red],#[fg=$thm_green]}$status_left_separator" - else - local show_left_separator="#[fg=$thm_green]#[bg=$thm_gray]#{?client_prefix,#[fg=$thm_red],#[fg=$thm_green]}$status_left_separator" - fi - - local show_icon="#{?client_prefix,#[bg=$thm_red],#[bg=$thm_green]}#[fg=$thm_bg]$icon " - - if [[ $status_fill == "icon" ]] - then - 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" - fi + local module=$( build_status_module "$index" "$icon" "$color" "$text" ) - if [[ $status_fill == "all" ]] - then - local show_text="#[fg=$thm_bg]$text" - local show_right_separator="#[fg=$thm_green]#[bg=$thm_bg]#{?client_prefix,#[fg=$thm_red],#[fg=$thm_green]}$status_right_separator" - fi - - if [[ $status_right_separator_inverse == "yes" ]] - then - local show_right_separator="#[fg=$thm_bg]$status_right_separator" - fi - - echo "$show_left_separator$show_icon$show_text$show_right_separator" + echo $module } diff --git a/status/user.sh b/status/user.sh index fc9b9ed..9cf2ea4 100644 --- a/status/user.sh +++ b/status/user.sh @@ -1,10 +1,10 @@ show_user() { - local index=$1 - local icon="$(get_tmux_option "@catppuccin_user_icon" "")" - local color="$(get_tmux_option "@catppuccin_user_color" "$thm_cyan")" - local text="$(get_tmux_option "@catppuccin_user_text" "#(whoami)")" + local index=$1 + local icon=$(get_tmux_option "@catppuccin_user_icon" "") + local color=$(get_tmux_option "@catppuccin_user_color" "$thm_cyan") + local text=$(get_tmux_option "@catppuccin_user_text" "#(whoami)") local module=$( build_status_module "$index" "$icon" "$color" "$text" ) - echo $module + echo $module }