feat(modules): refactor modules and extract common functionality

This commit is contained in:
Valentin Uveges 2023-08-08 11:45:45 +03:00
parent 56a447094a
commit 3b4bf404db
18 changed files with 200 additions and 352 deletions

View file

@ -31,6 +31,39 @@ setw() {
tmux_commands+=(set-window-option -gq "$option" "$value" ";") tmux_commands+=(set-window-option -gq "$option" "$value" ";")
} }
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
if [[ $status_color_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"
fi
if [[ $status_color_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_bg,nobold,nounderscore,noitalics]$status_right_separator"
fi
echo "$show_left_separator$show_icon$show_text$show_right_separator"
}
load_modules() { load_modules() {
local loaded_modules local loaded_modules
@ -95,14 +128,12 @@ main() {
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" "█")"
local window_color_fill="$(get_tmux_option "@catppuccin_window_color_fill" "number")" local window_color_fill="$(get_tmux_option "@catppuccin_window_color_fill" "number")" # number, all
local window_icon_position="$(get_tmux_option "@catppuccin_window_icon_position" "right")" local window_icon_position="$(get_tmux_option "@catppuccin_window_icon_position" "right")" # right, left
local window_format_style="$(get_tmux_option "@catppuccin_window_format_style" "directory")" # directory, application
local window_module="$(get_tmux_option "@catppuccin_window_module" "directory_in_window")" local window_format=$( load_modules "$PLUGIN_DIR/window" "window_format")
local window_current_module="$(get_tmux_option "@catppuccin_window_current_module" "directory_in_window_current")" local window_current_format=$( load_modules "$PLUGIN_DIR/window" "window_current_format")
local window_format=$( load_modules "$PLUGIN_DIR/window" "$window_module")
local window_current_format=$( load_modules "$PLUGIN_DIR/window" "$window_current_module")
setw window-status-format "${window_format}" setw window-status-format "${window_format}"
setw window-status-current-format "${window_current_format}" setw window-status-current-format "${window_current_format}"
@ -110,6 +141,7 @@ main() {
local status_left_separator="$(get_tmux_option "@catppuccin_status_left_separator" "")" 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="$(get_tmux_option "@catppuccin_status_right_separator" "█")"
local status_connect_separator="$(get_tmux_option "@catppuccin_status_connect_separator" "yes")" local status_connect_separator="$(get_tmux_option "@catppuccin_status_connect_separator" "yes")"
local status_color_fill="$(get_tmux_option "@catppuccin_status_color_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 "$PLUGIN_DIR/status" "$status_modules") local loaded_modules=$( load_modules "$PLUGIN_DIR/status" "$status_modules")

View file

@ -1,11 +0,0 @@
local show_directory_in_window_status
readonly show_directory_in_window_status="#[fg=$thm_bg,bg=$thm_blue] #I #[fg=$thm_fg,bg=$thm_gray] #{b:pane_current_path} "
local show_directory_in_window_status_current
readonly show_directory_in_window_status_current="#[fg=$thm_bg,bg=$thm_orange] #I #[fg=$thm_fg,bg=$thm_bg] #{b:pane_current_path} "
local show_window_in_window_status
readonly show_window_in_window_status="#[fg=$thm_fg,bg=$thm_bg] #W #[fg=$thm_bg,bg=$thm_blue] #I#[fg=$thm_blue,bg=$thm_bg]$l_right_separator "
local show_window_in_window_status_current
readonly show_window_in_window_status_current="#[fg=$thm_fg,bg=$thm_gray] #W #[fg=$thm_bg,bg=$thm_orange] #I#[fg=$thm_orange,bg=$thm_bg,nobold,nounderscore,noitalics]$l_right_separator "

View file

@ -1,29 +0,0 @@
local show_directory
readonly show_directory="#[fg=$thm_bg,bg=$thm_pink,nobold,nounderscore,noitalics] #{b:pane_current_path} #[bg=$thm_bg] "
local show_window
readonly show_window="#[fg=$thm_bg,bg=$thm_pink,nobold,nounderscore,noitalics] #W #[bg=$thm_bg] "
local show_session
readonly show_session="#{?client_prefix,#[bg=$thm_red],#[bg=$thm_green]}#[fg=$thm_bg] #S #[bg=$thm_bg] "
local show_directory_in_window_status
readonly show_directory_in_window_status="#[fg=$thm_bg,bg=$thm_blue,nobold,nounderscore,noitalics] #I #[fg=$thm_fg,bg=$thm_gray,nobold,nounderscore,noitalics] #{b:pane_current_path} "
local show_directory_in_window_status_current
readonly show_directory_in_window_status_current="#[fg=$thm_bg,bg=$thm_orange,nobold,nounderscore,noitalics] #I #[fg=$thm_fg,bg=$thm_bg,nobold,nounderscore,noitalics] #{b:pane_current_path} "
local show_window_in_window_status
readonly show_window_in_window_status="#[fg=$thm_fg,bg=$thm_bg,nobold,nounderscore,noitalics] #W #[fg=$thm_bg,bg=$thm_blue,nobold,nounderscore,noitalics] #I "
local show_window_in_window_status_current
readonly show_window_in_window_status_current="#[fg=$thm_fg,bg=$thm_gray,nobold,nounderscore,noitalics] #W #[fg=$thm_bg,bg=$thm_orange,nobold,nounderscore,noitalics] #I "
local show_user
readonly show_user="#[fg=$thm_bg,bg=$thm_cyan,nobold,nounderscore,noitalics] #(whoami) #[bg=$thm_bg] "
local show_host
readonly show_host="#[fg=$thm_bg,bg=$thm_magenta,nobold,nounderscore,noitalics] #H #[bg=$thm_bg] "
local show_date_time
readonly show_date_time="#[fg=$thm_bg,bg=$thm_blue,nobold,nounderscore,noitalics] $date_time #[bg=$thm_bg] "

View file

@ -1,29 +0,0 @@
local show_directory
readonly show_directory="#[fg=$thm_pink,bg=$thm_bg,nobold,nounderscore,noitalics]$r_left_separator#[fg=$thm_bg,bg=$thm_pink,nobold,nounderscore,noitalics]$directory_icon #[fg=$thm_fg,bg=$thm_gray] #{b:pane_current_path} #[fg=$thm_gray,bg=$thm_bg,nobold,nounderscore,noitalics]$r_right_separator "
local show_window
readonly show_window="#[fg=$thm_pink,bg=$thm_bg,nobold,nounderscore,noitalics]$r_left_separator#[fg=$thm_bg,bg=$thm_pink,nobold,nounderscore,noitalics]$window_icon #[fg=$thm_fg,bg=$thm_gray] #W #[fg=$thm_gray,bg=$thm_bg,nobold,nounderscore,noitalics]$r_right_separator "
local show_session
readonly show_session="#[fg=$thm_green,bg=$thm_bg,nobold,nounderscore,noitalics]#{?client_prefix,#[fg=$thm_red],#[fg=$thm_green]}$r_left_separator#[fg=$thm_bg,bg=$thm_green]#{?client_prefix,#[bg=$thm_red],#[bg=$thm_green]}$session_icon #[fg=$thm_fg,bg=$thm_gray] #S #[fg=$thm_gray,bg=$thm_bg,nobold,nounderscore,noitalics]$r_right_separator "
local show_directory_in_window_status
readonly show_directory_in_window_status="#[fg=$thm_bg,bg=$thm_blue] #I #[fg=$thm_fg,bg=$thm_gray] #{b:pane_current_path} "
local show_directory_in_window_status_current
readonly show_directory_in_window_status_current="#[fg=$thm_bg,bg=$thm_orange] #I #[fg=$thm_fg,bg=$thm_bg] #{b:pane_current_path} "
local show_window_in_window_status
readonly show_window_in_window_status="#[fg=$thm_gray,bg=$thm_bg,nobold,nounderscore,noitalics]$l_left_separator#[fg=$thm_fg,bg=$thm_gray]#W #[fg=$thm_bg,bg=$thm_blue] #I#[fg=$thm_blue,bg=$thm_bg,nobold,nounderscore,noitalics]$l_right_separator "
local show_window_in_window_status_current
readonly show_window_in_window_status_current="#[fg=$thm_gray,bg=$thm_bg,nobold,nounderscore,noitalics]$l_left_separator#[fg=$thm_fg,bg=$thm_gray]#W #[fg=$thm_bg,bg=$thm_orange] #I#[fg=$thm_orange,bg=$thm_bg,nobold,nounderscore,noitalics]$l_right_separator "
local show_user
readonly show_user="#[fg=$thm_cyan,bg=$thm_bg,nobold,nounderscore,noitalics]$r_left_separator#[fg=$thm_bg,bg=$thm_cyan,nobold,nounderscore,noitalics]$user_icon #[fg=$thm_fg,bg=$thm_gray] #(whoami) #[fg=$thm_gray,bg=$thm_bg,nobold,nounderscore,noitalics]$r_right_separator "
local show_host
readonly show_host="#[fg=$thm_magenta,bg=$thm_bg,nobold,nounderscore,noitalics]$r_left_separator#[fg=$thm_bg,bg=$thm_magenta,nobold,nounderscore,noitalics]$host_icon #[fg=$thm_fg,bg=$thm_gray] #H #[fg=$thm_gray,bg=$thm_bg,nobold,nounderscore,noitalics]$r_right_separator "
local show_date_time
readonly show_date_time="#[fg=$thm_blue,bg=$thm_bg,nobold,nounderscore,noitalics]$r_left_separator#[fg=$thm_bg,bg=$thm_blue,nobold,nounderscore,noitalics]$datetime_icon #[fg=$thm_fg,bg=$thm_gray] $date_time #[fg=$thm_gray,bg=$thm_bg,nobold,nounderscore,noitalics]$r_right_separator "

View file

@ -1,30 +0,0 @@
local show_directory
readonly show_directory="#[fg=$thm_pink,bg=$thm_bg,nobold,nounderscore,noitalics]$r_left_separator#[fg=$thm_bg,bg=$thm_pink,nobold,nounderscore,noitalics] $directory_icon #{b:pane_current_path} $r_right_separator"
local show_window
readonly show_window="#[fg=$thm_pink,bg=$thm_bg,nobold,nounderscore,noitalics]$r_left_separator#[fg=$thm_bg,bg=$thm_pink,nobold,nounderscore,noitalics] $window_icon #W $r_right_separator"
local show_session
readonly show_session="#[fg=$thm_green,bg=$thm_bg,nobold,nounderscore,noitalics]#{?client_prefix,#[fg=$thm_red],#[fg=$thm_green]}$r_left_separator#{?client_prefix,#[bg=$thm_red],#[bg=$thm_green]}#[fg=$thm_bg] $session_icon #S #{?client_prefix,#[bg=$thm_red],#[bg=$thm_green]}#[fg=$thm_bg]$r_right_separator"
local show_directory_in_window_status
readonly show_directory_in_window_status="#[fg=$thm_bg,bg=$thm_gray,nobold,noitalics,nounderscore]$l_left_separator #[fg=$thm_fg,bg=$thm_gray,nobold,noitalics,nounderscore]#I  #{b:pane_current_path} #[fg=$thm_gray,bg=$thm_bg,nobold,noitalics,nounderscore]$l_right_separator"
local show_directory_in_window_status_current
readonly show_directory_in_window_status_current="#[fg=$thm_bg,bg=$thm_blue,nobold,noitalics,nounderscore]$l_left_separator #[fg=$thm_bg,bg=$thm_blue,nobold,noitalics,nounderscore]#I  #{b:pane_current_path} #[fg=$thm_blue,bg=$thm_bg,nobold,noitalics,nounderscore]$l_right_separator"
local show_window_in_window_status
readonly show_window_in_window_status="#[fg=$thm_bg,bg=$thm_gray,nobold,noitalics,nounderscore]$l_left_separator #[fg=$thm_fg,bg=$thm_gray,nobold,noitalics,nounderscore]#W  #I #[fg=$thm_gray,bg=$thm_bg,nobold,noitalics,nounderscore]$l_right_separator"
local show_window_in_window_status_current
readonly show_window_in_window_status_current="#[fg=$thm_bg,bg=$thm_blue,nobold,noitalics,nounderscore]$l_left_separator #[fg=$thm_bg,bg=$thm_blue,nobold,noitalics,nounderscore]#W  #I #[fg=$thm_blue,bg=$thm_bg,nobold,noitalics,nounderscore]$l_right_separator"
local show_user
readonly show_user="#[fg=$thm_cyan,bg=$thm_bg,nobold,nounderscore,noitalics]$r_left_separator#[fg=$thm_bg,bg=$thm_cyan,nobold,nounderscore,noitalics] $user_icon #(whoami) $r_right_separator"
local show_host
readonly show_host="#[fg=$thm_magenta,bg=$thm_bg,nobold,nounderscore,noitalics]$r_left_separator#[fg=$thm_bg,bg=$thm_magenta,nobold,nounderscore,noitalics] $host_icon #H $r_right_separator"
local show_date_time
readonly show_date_time="#[fg=$thm_blue,bg=$thm_bg,nobold,nounderscore,noitalics]$r_left_separator#[fg=$thm_bg,bg=$thm_blue,nobold,nounderscore,noitalics] $datetime_icon $date_time $r_right_separator"

View file

@ -1,29 +0,0 @@
local show_directory
readonly show_directory="#[fg=$thm_pink,bg=$thm_bg,nobold,nounderscore,noitalics]$r_left_separator#[fg=$thm_bg,bg=$thm_pink,nobold,nounderscore,noitalics] #{b:pane_current_path} $r_right_separator"
local show_window
readonly show_window="#[fg=$thm_pink,bg=$thm_bg,nobold,nounderscore,noitalics]$r_left_separator#[fg=$thm_bg,bg=$thm_pink,nobold,nounderscore,noitalics] #W $r_right_separator"
local show_session
readonly show_session="#[fg=$thm_green,bg=$thm_bg,nobold,nounderscore,noitalics]#{?client_prefix,#[fg=$thm_red],#[fg=$thm_green]}$r_left_separator#{?client_prefix,#[bg=$thm_red],#[bg=$thm_green]}#[fg=$thm_bg] #S #{?client_prefix,#[bg=$thm_red],#[bg=$thm_green]}#[fg=$thm_bg]$r_right_separator"
local show_directory_in_window_status
readonly show_directory_in_window_status="#[fg=$thm_bg,bg=$thm_gray,nobold,noitalics,nounderscore]$l_left_separator #[fg=$thm_fg,bg=$thm_gray,nobold,noitalics,nounderscore]#I  #{b:pane_current_path} #[fg=$thm_gray,bg=$thm_bg,nobold,noitalics,nounderscore]$l_right_separator"
local show_directory_in_window_status_current
readonly show_directory_in_window_status_current="#[fg=$thm_bg,bg=$thm_blue,nobold,noitalics,nounderscore]$l_left_separator #[fg=$thm_bg,bg=$thm_blue,nobold,noitalics,nounderscore]#I  #{b:pane_current_path} #[fg=$thm_blue,bg=$thm_bg,nobold,noitalics,nounderscore]$l_right_separator"
local show_window_in_window_status
readonly show_window_in_window_status="#[fg=$thm_bg,bg=$thm_gray,nobold,noitalics,nounderscore]$l_left_separator #[fg=$thm_fg,bg=$thm_gray,nobold,noitalics,nounderscore]#W  #I #[fg=$thm_gray,bg=$thm_bg,nobold,noitalics,nounderscore]$l_right_separator"
local show_window_in_window_status_current
readonly show_window_in_window_status_current="#[fg=$thm_bg,bg=$thm_blue,nobold,noitalics,nounderscore]$l_left_separator #[fg=$thm_bg,bg=$thm_blue,nobold,noitalics,nounderscore]#W  #I #[fg=$thm_blue,bg=$thm_bg,nobold,noitalics,nounderscore]$l_right_separator"
local show_user
readonly show_user="#[fg=$thm_cyan,bg=$thm_bg,nobold,nounderscore,noitalics]$r_left_separator#[fg=$thm_bg,bg=$thm_cyan,nobold,nounderscore,noitalics] #(whoami) $r_right_separator"
local show_host
readonly show_host="#[fg=$thm_magenta,bg=$thm_bg,nobold,nounderscore,noitalics]$r_left_separator#[fg=$thm_bg,bg=$thm_magenta,nobold,nounderscore,noitalics] #H $r_right_separator"
local show_date_time
readonly show_date_time="#[fg=$thm_blue,bg=$thm_bg,nobold,nounderscore,noitalics]$r_left_separator#[fg=$thm_bg,bg=$thm_blue,nobold,nounderscore,noitalics] $date_time $r_right_separator"

View file

@ -1,16 +1,10 @@
show_application() { show_application() {
local index=$1
local icon="$(get_tmux_option "@catppuccin_application_icon" "")" 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")"
if [[ $1 -eq 0 || $status_connect_separator == "no" ]] local module=$( build_status_module "$index" "$icon" "$color" "$text" )
then
local show_left_separator="#[fg=$thm_pink,bg=$thm_bg,nobold,nounderscore,noitalics]$status_left_separator"
else
local show_left_separator="#[fg=$thm_pink,bg=$thm_gray,nobold,nounderscore,noitalics]$status_left_separator"
fi
local show_icon="#[fg=$thm_bg,bg=$thm_pink,nobold,nounderscore,noitalics]$icon " echo $module
local show_text="#[fg=$thm_fg,bg=$thm_gray] #W"
local show_right_separator="#[fg=$thm_gray,bg=$thm_bg,nobold,nounderscore,noitalics]$status_right_separator"
echo "$show_left_separator$show_icon$show_text$show_right_separator"
} }

View file

@ -1,18 +1,11 @@
show_date_time() { show_date_time() {
local icon="$(get_tmux_option "@catppuccin_datetime_icon" "󰃰")" local index=$1
local format="$(get_tmux_option "@catppuccin_date_time_format" "%Y-%m-%d %H:%M")" 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:%S")"
if [[ $1 -eq 0 || $status_connect_separator == "no" ]] local module=$( build_status_module "$index" "$icon" "$color" "$text" )
then
local show_left_separator="#[fg=$thm_blue,bg=$thm_bg,nobold,nounderscore,noitalics]$status_left_separator"
else
local show_left_separator="#[fg=$thm_blue,bg=$thm_gray,nobold,nounderscore,noitalics]$status_left_separator"
fi
local show_icon="#[fg=$thm_bg,bg=$thm_blue,nobold,nounderscore,noitalics]$icon " echo $module
local show_text="#[fg=$thm_fg,bg=$thm_gray] $format"
local show_right_separator="#[fg=$thm_gray,bg=$thm_bg,nobold,nounderscore,noitalics]$status_right_separator"
echo "$show_left_separator$show_icon$show_text$show_right_separator"
} }

View file

@ -1,16 +1,10 @@
show_directory() { show_directory() {
local index=$1
local icon="$(get_tmux_option "@catppuccin_directory_icon" "")" 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}")"
if [[ $1 -eq 0 || $status_connect_separator == "no" ]] local module=$( build_status_module "$index" "$icon" "$color" "$text" )
then
local show_left_separator="#[fg=$thm_pink,bg=$thm_bg,nobold,nounderscore,noitalics]$status_left_separator"
else
local show_left_separator="#[fg=$thm_pink,bg=$thm_gray,nobold,nounderscore,noitalics]$status_left_separator"
fi
local show_icon="#[fg=$thm_bg,bg=$thm_pink,nobold,nounderscore,noitalics]$icon " echo $module
local show_text="#[fg=$thm_fg,bg=$thm_gray] #{b:pane_current_path}"
local show_right_separator="#[fg=$thm_gray,bg=$thm_bg,nobold,nounderscore,noitalics]$status_right_separator"
echo "$show_left_separator$show_icon$show_text$show_right_separator"
} }

View file

@ -1,16 +1,10 @@
show_host() { show_host() {
local index=$1
local icon="$(get_tmux_option "@catppuccin_host_icon" "󰒋")" local icon="$(get_tmux_option "@catppuccin_host_icon" "󰒋")"
local color="$(get_tmux_option "@catppuccin_host_color" "$thm_blue")"
local text="$(get_tmux_option "@catppuccin_host_text" "#H")"
if [[ $1 -eq 0 || $status_connect_separator == "no" ]] local module=$( build_status_module "$index" "$icon" "$color" "$text" )
then
local show_left_separator="#[fg=$thm_blue,bg=$thm_bg,nobold,nounderscore,noitalics]$status_left_separator"
else
local show_left_separator="#[fg=$thm_blue,bg=$thm_gray,nobold,nounderscore,noitalics]$status_left_separator"
fi
local show_icon="#[fg=$thm_bg,bg=$thm_blue,nobold,nounderscore,noitalics]$icon " echo $module
local show_text="#[fg=$thm_fg,bg=$thm_gray] #H"
local show_right_separator="#[fg=$thm_gray,bg=$thm_bg,nobold,nounderscore,noitalics]$status_right_separator"
echo "$show_left_separator$show_icon$show_text$show_right_separator"
} }

View file

@ -1,7 +1,9 @@
show_session() { show_session() {
local index=$1
local icon="$(get_tmux_option "@catppuccin_session_icon" "")" local icon="$(get_tmux_option "@catppuccin_session_icon" "")"
local text="$(get_tmux_option "@catppuccin_host_text" "#S")"
if [[ $1 -eq 0 || $status_connect_separator == "no" ]] if [[ $index -eq 0 || $status_connect_separator == "no" ]]
then then
local show_left_separator="#[fg=$thm_green]#[bg=$thm_bg]#{?client_prefix,#[fg=$thm_red],#[fg=$thm_green]}$status_left_separator" local show_left_separator="#[fg=$thm_green]#[bg=$thm_bg]#{?client_prefix,#[fg=$thm_red],#[fg=$thm_green]}$status_left_separator"
else else
@ -9,8 +11,18 @@ show_session() {
fi fi
local show_icon="#{?client_prefix,#[bg=$thm_red],#[bg=$thm_green]}#[fg=$thm_bg]$icon " local show_icon="#{?client_prefix,#[bg=$thm_red],#[bg=$thm_green]}#[fg=$thm_bg]$icon "
local show_text="#[fg=$thm_fg,bg=$thm_gray] #S"
if [[ $status_color_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" local show_right_separator="#[fg=$thm_gray,bg=$thm_bg,nobold,nounderscore,noitalics]$status_right_separator"
fi
if [[ $status_color_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
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,16 +1,10 @@
show_user() { show_user() {
local index=$1
local icon="$(get_tmux_option "@catppuccin_user_icon" "")" local icon="$(get_tmux_option "@catppuccin_user_icon" "")"
local color="$(get_tmux_option "@catppuccin_user_color" "$thm_blue")"
local text="$(get_tmux_option "@catppuccin_user_text" "#(whoami)")"
if [[ $1 -eq 0 || $status_connect_separator == "no" ]] local module=$( build_status_module "$index" "$icon" "$color" "$text" )
then
local show_left_separator="#[fg=$thm_blue,bg=$thm_bg,nobold,nounderscore,noitalics]$status_left_separator"
else
local show_left_separator="#[fg=$thm_blue,bg=$thm_gray,nobold,nounderscore,noitalics]$status_left_separator"
fi
local show_icon="#[fg=$thm_bg,bg=$thm_blue,nobold,nounderscore,noitalics]$icon " echo $module
local show_text="#[fg=$thm_fg,bg=$thm_gray] #(whoami)"
local show_right_separator="#[fg=$thm_gray,bg=$thm_bg,nobold,nounderscore,noitalics]$status_right_separator"
echo "$show_left_separator$show_icon$show_text$show_right_separator"
} }

View file

@ -1,37 +0,0 @@
show_application_in_window() {
if [[ $window_color_fill == "number" ]]
then
local show_icon="#[fg=$thm_bg,bg=$thm_blue]#I"
local show_middle_separator="#[fg=$thm_blue,bg=$thm_gray,nobold,nounderscore,noitalics]$window_middle_separator"
local show_text="#[fg=$thm_fg,bg=$thm_gray]#W"
if [[ $window_icon_position == "right" ]]
then
local show_left_separator="#[fg=$thm_gray,bg=$thm_bg,nobold,nounderscore,noitalics]$window_left_separator"
local show_right_separator="#[fg=$thm_blue,bg=$thm_bg]$window_right_separator"
echo "$show_left_separator$show_text$show_middle_separator$show_icon$show_right_separator"
else
local show_left_separator="#[fg=$thm_blue,bg=$thm_bg,nobold,nounderscore,noitalics]$window_left_separator"
local show_right_separator="#[fg=$thm_gray,bg=$thm_bg]$window_right_separator"
echo "$show_left_separator$show_icon$show_middle_separator$show_text$show_right_separator"
fi
else
local show_left_separator="#[fg=$thm_blue,bg=$thm_bg,nobold,nounderscore,noitalics]$window_left_separator"
local show_icon="#[fg=$thm_bg,bg=$thm_blue]#I"
local show_middle_separator="#[fg=$thm_gray,bg=$thm_blue,nobold,nounderscore,noitalics]$window_middle_separator"
local show_text="#[fg=$thm_bg,bg=$thm_blue]#{b:pane_current_path}"
local show_right_separator="#[fg=$thm_blue,bg=$thm_bg]$window_right_separator"
if [[ $window_icon_position == "right" ]]
then
echo "$show_left_separator$show_text$show_middle_separator$show_icon$show_right_separator"
else
echo "$show_left_separator$show_icon$show_middle_separator$show_text$show_right_separator"
fi
fi
}

View file

@ -1,40 +0,0 @@
show_application_in_window_current() {
if [[ $window_color_fill == "number" ]]
then
local show_icon="#[fg=$thm_bg,bg=$thm_orange]#I"
local show_middle_separator="#[fg=$thm_orange,bg=$thm_bg,nobold,nounderscore,noitalics]$window_middle_separator"
local show_text="#[fg=$thm_fg,bg=$thm_bg]#W"
if [[ $window_icon_position == "right" ]]
then
local show_left_separator="#[fg=$thm_bg,bg=$thm_bg,nobold,nounderscore,noitalics]$window_left_separator"
local show_right_separator="#[fg=$thm_orange,bg=$thm_bg]$window_right_separator"
echo "$show_left_separator$show_text$show_middle_separator$show_icon$show_right_separator"
else
local show_left_separator="#[fg=$thm_orange,bg=$thm_bg,nobold,nounderscore,noitalics]$window_left_separator"
local show_right_separator="#[fg=$thm_bg,bg=$thm_bg]$window_right_separator"
echo "$show_left_separator$show_icon$show_middle_separator$show_text$show_right_separator"
fi
else
local show_left_separator="#[fg=$thm_orange,bg=$thm_bg,nobold,nounderscore,noitalics]$window_left_separator"
local show_icon="#[fg=$thm_bg,bg=$thm_orange]#I"
local show_middle_separator="#[fg=$thm_bg,bg=$thm_orange,nobold,nounderscore,noitalics]$window_middle_separator"
local show_text="#[fg=$thm_bg,bg=$thm_orange]#{b:pane_current_path}"
local show_right_separator="#[fg=$thm_orange,bg=$thm_bg]$window_right_separator"
if [[ $window_icon_position == "right" ]]
then
echo "$show_left_separator$show_text$show_middle_separator$show_icon$show_right_separator"
else
echo "$show_left_separator$show_icon$show_middle_separator$show_text$show_right_separator"
fi
fi
}

View file

@ -1,38 +0,0 @@
show_directory_in_window() {
if [[ $window_color_fill == "number" ]]
then
local show_icon="#[fg=$thm_bg,bg=$thm_blue]#I"
local show_middle_separator="#[fg=$thm_blue,bg=$thm_gray,nobold,nounderscore,noitalics]$window_middle_separator"
local show_text="#[fg=$thm_fg,bg=$thm_gray]#{b:pane_current_path}"
if [[ $window_icon_position == "right" ]]
then
local show_left_separator="#[fg=$thm_gray,bg=$thm_bg,nobold,nounderscore,noitalics]$window_left_separator"
local show_right_separator="#[fg=$thm_blue,bg=$thm_bg]$window_right_separator"
echo "$show_left_separator$show_text$show_middle_separator$show_icon$show_right_separator"
else
local show_left_separator="#[fg=$thm_blue,bg=$thm_bg,nobold,nounderscore,noitalics]$window_left_separator"
local show_right_separator="#[fg=$thm_gray,bg=$thm_bg]$window_right_separator"
echo "$show_left_separator$show_icon$show_middle_separator$show_text$show_right_separator"
fi
else
local show_left_separator="#[fg=$thm_blue,bg=$thm_bg,nobold,nounderscore,noitalics]$window_left_separator"
local show_icon="#[fg=$thm_bg,bg=$thm_blue]#I"
local show_middle_separator="#[fg=$thm_gray,bg=$thm_blue,nobold,nounderscore,noitalics]$window_middle_separator"
local show_text="#[fg=$thm_bg,bg=$thm_blue]#{b:pane_current_path}"
local show_right_separator="#[fg=$thm_blue,bg=$thm_bg]$window_right_separator"
if [[ $window_icon_position == "right" ]]
then
echo "$show_left_separator$show_text$show_middle_separator$show_icon$show_right_separator"
else
echo "$show_left_separator$show_icon$show_middle_separator$show_text$show_right_separator"
fi
fi
}

View file

@ -1,41 +0,0 @@
show_directory_in_window_current() {
if [[ $window_color_fill == "number" ]]
then
local show_icon="#[fg=$thm_bg,bg=$thm_orange]#I"
local show_middle_separator="#[fg=$thm_orange,bg=$thm_bg,nobold,nounderscore,noitalics]$window_middle_separator"
local show_text="#[fg=$thm_fg,bg=$thm_bg]#{b:pane_current_path}"
if [[ $window_icon_position == "right" ]]
then
local show_left_separator="#[fg=$thm_bg,bg=$thm_bg,nobold,nounderscore,noitalics]$window_left_separator"
local show_right_separator="#[fg=$thm_orange,bg=$thm_bg]$window_right_separator"
echo "$show_left_separator$show_text$show_middle_separator$show_icon$show_right_separator"
else
local show_left_separator="#[fg=$thm_orange,bg=$thm_bg,nobold,nounderscore,noitalics]$window_left_separator"
local show_right_separator="#[fg=$thm_bg,bg=$thm_bg]$window_right_separator"
echo "$show_left_separator$show_icon$show_middle_separator$show_text$show_right_separator"
fi
else
local show_left_separator="#[fg=$thm_orange,bg=$thm_bg,nobold,nounderscore,noitalics]$window_left_separator"
local show_icon="#[fg=$thm_bg,bg=$thm_orange]#I"
local show_middle_separator="#[fg=$thm_bg,bg=$thm_orange,nobold,nounderscore,noitalics]$window_middle_separator"
local show_text="#[fg=$thm_bg,bg=$thm_orange]#{b:pane_current_path}"
local show_right_separator="#[fg=$thm_orange,bg=$thm_bg]$window_right_separator"
if [[ $window_icon_position == "right" ]]
then
echo "$show_left_separator$show_text$show_middle_separator$show_icon$show_right_separator"
else
echo "$show_left_separator$show_icon$show_middle_separator$show_text$show_right_separator"
fi
fi
}

View file

@ -0,0 +1,60 @@
show_window_current_format() {
local icon="#I"
local color="$thm_orange"
local background="$thm_bg"
local text
local window_format
if [[ $window_format_style == "directory" ]]
then
text="$(get_tmux_option "@catppuccin_window_current_format_directory_text" "#{b:pane_current_path}")"
fi
if [[ $window_format_style == "application" ]]
then
text="#W"
fi
if [[ $window_color_fill == "all" ]]
then
local show_left_separator="#[fg=$color,bg=$background,nobold,nounderscore,noitalics]$window_left_separator"
local show_icon="#[fg=$background,bg=$color]$icon"
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=$background]$window_right_separator"
fi
if [[ $window_color_fill == "number" ]]
then
local show_icon="#[fg=$background,bg=$color]$icon"
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_icon_position == "right" ]]
then
local show_left_separator="#[fg=$background,bg=$background,nobold,nounderscore,noitalics]$window_left_separator"
local show_right_separator="#[fg=$color,bg=$background]$window_right_separator"
fi
if [[ $window_icon_position == "left" ]]
then
local show_right_separator="#[fg=$background,bg=$background,nobold,nounderscore,noitalics]$window_right_separator"
local show_left_separator="#[fg=$color,bg=$background]$window_left_separator"
fi
fi
if [[ $window_icon_position == "right" ]]
then
window_format="$show_left_separator$show_text$show_middle_separator$show_icon$show_right_separator"
fi
if [[ $window_icon_position == "left" ]]
then
window_format="$show_left_separator$show_icon$show_middle_separator$show_text$show_right_separator"
fi
echo $window_format
}

59
window/window_format.sh Normal file
View file

@ -0,0 +1,59 @@
show_window_format() {
local icon="#I"
local color="$thm_blue"
local text
local window_format
if [[ $window_format_style == "directory" ]]
then
text="$(get_tmux_option "@catppuccin_window_format_directory_text" "#{b:pane_current_path}")"
fi
if [[ $window_format_style == "application" ]]
then
text="#W"
fi
if [[ $window_color_fill == "all" ]]
then
local show_left_separator="#[fg=$thm_gray,bg=$thm_bg,nobold,nounderscore,noitalics]$window_left_separator"
local show_icon="#[fg=$thm_fg,bg=$thm_gray]$icon"
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"
fi
if [[ $window_color_fill == "number" ]]
then
local show_icon="#[fg=$thm_bg,bg=$color]$icon"
local show_middle_separator="#[fg=$color,bg=$thm_gray,nobold,nounderscore,noitalics]$window_middle_separator"
local show_text="#[fg=$thm_fg,bg=$thm_gray]$text"
if [[ $window_icon_position == "right" ]]
then
local show_left_separator="#[fg=$thm_gray,bg=$thm_bg,nobold,nounderscore,noitalics]$window_left_separator"
local show_right_separator="#[fg=$color,bg=$thm_bg]$window_right_separator"
fi
if [[ $window_icon_position == "left" ]]
then
local show_right_separator="#[fg=$thm_gray,bg=$thm_bg,nobold,nounderscore,noitalics]$window_right_separator"
local show_left_separator="#[fg=$color,bg=$thm_bg]$window_left_separator"
fi
fi
if [[ $window_icon_position == "right" ]]
then
window_format="$show_left_separator$show_text$show_middle_separator$show_icon$show_right_separator"
fi
if [[ $window_icon_position == "left" ]]
then
window_format="$show_left_separator$show_icon$show_middle_separator$show_text$show_right_separator"
fi
echo $window_format
}