feat(modules): simplify parameters and use consistency in naming
This commit is contained in:
parent
480eebcb62
commit
c7ee28aafe
5 changed files with 30 additions and 51 deletions
|
@ -32,7 +32,7 @@ setw() {
|
||||||
}
|
}
|
||||||
|
|
||||||
build_window_format() {
|
build_window_format() {
|
||||||
local icon="$1"
|
local number="$1"
|
||||||
local color="$2"
|
local color="$2"
|
||||||
local background="$3"
|
local background="$3"
|
||||||
local text="$4"
|
local text="$4"
|
||||||
|
@ -45,7 +45,7 @@ build_window_format() {
|
||||||
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_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_icon="#[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"
|
||||||
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"
|
||||||
|
@ -55,7 +55,7 @@ build_window_format() {
|
||||||
if [[ $fill == "all" ]]
|
if [[ $fill == "all" ]]
|
||||||
then
|
then
|
||||||
local show_left_separator="#[fg=$color,bg=$thm_bg,nobold,nounderscore,noitalics]$window_left_separator"
|
local show_left_separator="#[fg=$color,bg=$thm_bg,nobold,nounderscore,noitalics]$window_left_separator"
|
||||||
local show_icon="#[fg=$background,bg=$color]$icon"
|
local show_icon="#[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"
|
||||||
local show_right_separator="#[fg=$color,bg=$thm_bg]$window_right_separator"
|
local show_right_separator="#[fg=$color,bg=$thm_bg]$window_right_separator"
|
||||||
|
@ -64,17 +64,17 @@ build_window_format() {
|
||||||
|
|
||||||
if [[ $fill == "number" ]]
|
if [[ $fill == "number" ]]
|
||||||
then
|
then
|
||||||
local show_icon="#[fg=$background,bg=$color]$icon"
|
local show_icon="#[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_icon_position == "right" ]]
|
if [[ $window_number_position == "right" ]]
|
||||||
then
|
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"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $window_icon_position == "left" ]]
|
if [[ $window_number_position == "left" ]]
|
||||||
then
|
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"
|
||||||
|
@ -82,12 +82,12 @@ build_window_format() {
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $window_icon_position == "right" ]]
|
if [[ $window_number_position == "right" ]]
|
||||||
then
|
then
|
||||||
window_format="$show_left_separator$show_text$show_middle_separator$show_icon$show_right_separator"
|
window_format="$show_left_separator$show_text$show_middle_separator$show_icon$show_right_separator"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $window_icon_position == "left" ]]
|
if [[ $window_number_position == "left" ]]
|
||||||
then
|
then
|
||||||
window_format="$show_left_separator$show_icon$show_middle_separator$show_text$show_right_separator"
|
window_format="$show_left_separator$show_icon$show_middle_separator$show_text$show_right_separator"
|
||||||
fi
|
fi
|
||||||
|
@ -108,14 +108,14 @@ build_status_module() {
|
||||||
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"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $status_color_fill == "icon" ]]
|
if [[ $status_fill == "icon" ]]
|
||||||
then
|
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"
|
local show_right_separator="#[fg=$thm_gray,bg=$thm_bg,nobold,nounderscore,noitalics]$status_right_separator"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $status_color_fill == "all" ]]
|
if [[ $status_fill == "all" ]]
|
||||||
then
|
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_bg,bg=$color]$text"
|
local show_text="#[fg=$thm_bg,bg=$color]$text"
|
||||||
|
@ -194,10 +194,9 @@ 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_icon_position="$(get_tmux_option "@catppuccin_window_icon_position" "left")" # right, left
|
local window_number_position="$(get_tmux_option "@catppuccin_window_number_position" "left")" # right, left
|
||||||
local window_format_style="$(get_tmux_option "@catppuccin_window_format_style" "directory")" # directory, application
|
|
||||||
|
|
||||||
local window_format=$( load_modules "$PLUGIN_DIR/window" "window_format")
|
local window_format=$( load_modules "$PLUGIN_DIR/window" "window_default_format")
|
||||||
local window_current_format=$( load_modules "$PLUGIN_DIR/window" "window_current_format")
|
local window_current_format=$( load_modules "$PLUGIN_DIR/window" "window_current_format")
|
||||||
|
|
||||||
setw window-status-format "${window_format}"
|
setw window-status-format "${window_format}"
|
||||||
|
@ -207,7 +206,7 @@ main() {
|
||||||
local status_right_separator="$(get_tmux_option "@catppuccin_status_right_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_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_connect_separator="$(get_tmux_option "@catppuccin_status_connect_separator" "yes")"
|
||||||
local status_color_fill="$(get_tmux_option "@catppuccin_status_color_fill" "icon")"
|
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 "$PLUGIN_DIR/status" "$status_modules")
|
local loaded_modules=$( load_modules "$PLUGIN_DIR/status" "$status_modules")
|
||||||
|
|
|
@ -12,13 +12,13 @@ show_session() {
|
||||||
|
|
||||||
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 "
|
||||||
|
|
||||||
if [[ $status_color_fill == "icon" ]]
|
if [[ $status_fill == "icon" ]]
|
||||||
then
|
then
|
||||||
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"
|
local show_right_separator="#[fg=$thm_gray,bg=$thm_bg,nobold,nounderscore,noitalics]$status_right_separator"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $status_color_fill == "all" ]]
|
if [[ $status_fill == "all" ]]
|
||||||
then
|
then
|
||||||
local show_text="#[fg=$thm_bg]$text"
|
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"
|
local show_right_separator="#[fg=$thm_green]#[bg=$thm_bg]#{?client_prefix,#[fg=$thm_red],#[fg=$thm_green]}$status_right_separator"
|
||||||
|
|
|
@ -1,21 +1,11 @@
|
||||||
show_window_current_format() {
|
show_window_current_format() {
|
||||||
local icon="#I"
|
local number="#I"
|
||||||
local color="$thm_orange"
|
local color="$thm_orange"
|
||||||
local background="$thm_bg"
|
local background="$thm_bg"
|
||||||
local text
|
local text="$(get_tmux_option "@catppuccin_window_current_text" "#{b:pane_current_path}")" # use #W for application instead of directory
|
||||||
local fill="$(get_tmux_option "@catppuccin_window_current_color_fill" "number")" # number, all, none
|
local fill="$(get_tmux_option "@catppuccin_window_current_fill" "number")" # number, all, none
|
||||||
|
|
||||||
if [[ $window_format_style == "directory" ]]
|
local current_window_format=$( build_window_format "$number" "$color" "$background" "$text" "$fill" )
|
||||||
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
|
|
||||||
|
|
||||||
local current_window_format=$( build_window_format "$icon" "$color" "$background" "$text" "$fill" )
|
|
||||||
|
|
||||||
echo "$current_window_format"
|
echo "$current_window_format"
|
||||||
}
|
}
|
||||||
|
|
11
window/window_default_format.sh
Normal file
11
window/window_default_format.sh
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
show_window_default_format() {
|
||||||
|
local number="#I"
|
||||||
|
local color="$thm_blue"
|
||||||
|
local background="$thm_gray"
|
||||||
|
local text="$(get_tmux_option "@catppuccin_window_default_text" "#{b:pane_current_path}")" # use #W for application instead of directory
|
||||||
|
local fill="$(get_tmux_option "@catppuccin_window_default_fill" "number")" # number, all, none
|
||||||
|
|
||||||
|
local default_window_format=$( build_window_format "$number" "$color" "$background" "$text" "$fill" )
|
||||||
|
|
||||||
|
echo "$default_window_format"
|
||||||
|
}
|
|
@ -1,21 +0,0 @@
|
||||||
show_window_format() {
|
|
||||||
local icon="#I"
|
|
||||||
local color="$thm_blue"
|
|
||||||
local background="$thm_gray"
|
|
||||||
local text
|
|
||||||
local fill="$(get_tmux_option "@catppuccin_window_color_fill" "number")" # number, all, none
|
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
local current_window_format=$( build_window_format "$icon" "$color" "$background" "$text" "$fill")
|
|
||||||
|
|
||||||
echo "$current_window_format"
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue