Merge pull request #114 from Em1lT/fix-conflicts
Pane customization options
This commit is contained in:
commit
bfc52dae6d
3 changed files with 120 additions and 3 deletions
19
README.md
19
README.md
|
@ -25,6 +25,7 @@
|
|||
2. [Window default](#window-default)
|
||||
3. [Window current](#window-current)
|
||||
4. [Status](#status)
|
||||
4. [Pane](#pane)
|
||||
5. [Customizing modules](#customizing-modules)
|
||||
6. [Battery module](#battery-module)
|
||||
7. [CPU module](#CPU-module)
|
||||
|
@ -223,6 +224,24 @@ Values:
|
|||
- icon - only the icon of the module will have color
|
||||
- all - the entire module will have the same color
|
||||
|
||||
### Pane
|
||||
|
||||
```sh
|
||||
tmux_orange="#fab387"
|
||||
set -g @catppuccin_pane_status_enabled "yes"
|
||||
set -g @catppuccin_pane_border_status "top"
|
||||
set -g @catppuccin_pane_left_separator ""
|
||||
set -g @catppuccin_pane_right_separator ""
|
||||
set -g @catppuccin_pane_middle_separator "█ "
|
||||
set -g @catppuccin_pane_number_position "left"
|
||||
set -g @catppuccin_pane_default_fill "number"
|
||||
set -g @catppuccin_pane_default_text "#{b:pane_current_path}"
|
||||
set -g @catppuccin_pane_border_style "fg=$tmux_orange"
|
||||
set -g @catppuccin_pane_active_border_style "fg=$tmux_orange"
|
||||
set -g @catppuccin_pane_color "$tmux_orange"
|
||||
set -g @catppuccin_pane_background_color "$tmux_orange"
|
||||
```
|
||||
|
||||
#### Set the module list
|
||||
```sh
|
||||
set -g @catppuccin_status_modules_right "application session"
|
||||
|
|
|
@ -60,6 +60,69 @@ build_window_icon() {
|
|||
echo "$show_window_status"
|
||||
}
|
||||
|
||||
build_pane_format() {
|
||||
local number=$1
|
||||
local color=$2
|
||||
local background=$3
|
||||
local text=$4
|
||||
local fill=$5
|
||||
|
||||
if [ "$pane_status_enable" = "yes" ]
|
||||
then
|
||||
if [ "$fill" = "none" ]
|
||||
then
|
||||
local show_left_separator="#[fg=$thm_gray,bg=$thm_bg,nobold,nounderscore,noitalics]$pane_left_separator"
|
||||
local show_number="#[fg=$thm_fg,bg=$thm_gray]$number"
|
||||
local show_middle_separator="#[fg=$thm_fg,bg=$thm_gray,nobold,nounderscore,noitalics]$pane_middle_separator"
|
||||
local show_text="#[fg=$thm_fg,bg=$thm_gray]$text"
|
||||
local show_right_separator="#[fg=$thm_gray,bg=$thm_bg]$pane_right_separator"
|
||||
fi
|
||||
|
||||
if [ "$fill" = "all" ]
|
||||
then
|
||||
local show_left_separator="#[fg=$color,bg=$thm_bg,nobold,nounderscore,noitalics]$pane_left_separator"
|
||||
local show_number="#[fg=$background,bg=$color]$number"
|
||||
local show_middle_separator="#[fg=$background,bg=$color,nobold,nounderscore,noitalics]$pane_middle_separator"
|
||||
local show_text="#[fg=$background,bg=$color]$text"
|
||||
local show_right_separator="#[fg=$color,bg=$thm_bg]$pane_right_separator"
|
||||
fi
|
||||
|
||||
if [ "$fill" = "number" ]
|
||||
then
|
||||
local show_number="#[fg=$background,bg=$color]$number"
|
||||
local show_middle_separator="#[fg=$color,bg=$background,nobold,nounderscore,noitalics]$pane_middle_separator"
|
||||
local show_text="#[fg=$thm_fg,bg=$background]$text"
|
||||
|
||||
if [ "$pane_number_position" = "right" ]
|
||||
then
|
||||
local show_left_separator="#[fg=$background,bg=$thm_bg,nobold,nounderscore,noitalics]$pane_left_separator"
|
||||
local show_right_separator="#[fg=$color,bg=$thm_bg]$pane_right_separator"
|
||||
fi
|
||||
|
||||
if [ "$pane_number_position" = "left" ]
|
||||
then
|
||||
local show_right_separator="#[fg=$background,bg=$thm_bg,nobold,nounderscore,noitalics]$pane_right_separator"
|
||||
local show_left_separator="#[fg=$color,bg=$thm_bg]$pane_left_separator"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
local final_pane_format
|
||||
|
||||
if [ "$pane_number_position" = "right" ]
|
||||
then
|
||||
final_pane_format="$show_left_separator$show_text$show_middle_separator$show_number$show_right_separator"
|
||||
fi
|
||||
|
||||
if [ "$pane_number_position" = "left" ]
|
||||
then
|
||||
final_pane_format="$show_left_separator$show_number$show_middle_separator$show_text$show_right_separator"
|
||||
fi
|
||||
|
||||
echo "$final_pane_format"
|
||||
fi
|
||||
}
|
||||
|
||||
build_window_format() {
|
||||
local number=$1
|
||||
local color=$2
|
||||
|
@ -201,6 +264,7 @@ load_modules() {
|
|||
local modules_custom_path=$custom_path
|
||||
local modules_status_path=$PLUGIN_DIR/status
|
||||
local modules_window_path=$PLUGIN_DIR/window
|
||||
local modules_pane_path=$PLUGIN_DIR/pane
|
||||
|
||||
local module_index=0;
|
||||
local module_name
|
||||
|
@ -247,6 +311,17 @@ load_modules() {
|
|||
continue
|
||||
fi
|
||||
|
||||
local module_path=$modules_pane_path/$module_name.sh
|
||||
source $module_path
|
||||
|
||||
if [ 0 -eq $? ]
|
||||
then
|
||||
loaded_modules="$loaded_modules$( show_$module_name $module_index )"
|
||||
module_index=$module_index+1
|
||||
continue
|
||||
fi
|
||||
|
||||
|
||||
done
|
||||
|
||||
echo "$loaded_modules"
|
||||
|
@ -285,10 +360,21 @@ main() {
|
|||
set message-command-style "fg=${thm_cyan},bg=${thm_gray},align=centre"
|
||||
|
||||
# panes
|
||||
local pane_status_enable=$(get_tmux_option "@catppuccin_pane_status_enabled" "no") # yes
|
||||
local pane_border_status=$(get_tmux_option "@catppuccin_pane_border_status" "top") # bottom
|
||||
local pane_border_style=$(get_tmux_option "@catppuccin_pane_border_style" "fg=${thm_gray}")
|
||||
local pane_active_border_style=$(get_tmux_option "@catppuccin_pane_active_border_style" "fg=${thm_blue}")
|
||||
set pane-border-style "${pane_border_style}"
|
||||
set pane-active-border-style "${pane_active_border_style}"
|
||||
local pane_active_border_style=$(get_tmux_option "@catppuccin_pane_active_border_style" "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" "█")
|
||||
local pane_right_separator=$(get_tmux_option "@catppuccin_pane_right_separator" "█")
|
||||
local pane_number_position=$(get_tmux_option "@catppuccin_pane_number_position" "left") # right, left
|
||||
local pane_format=$( load_modules "pane_default_format")
|
||||
|
||||
setw pane-border-status "$pane_border_status"
|
||||
setw pane-active-border-style "$pane_active_border_style"
|
||||
setw pane-border-style "$pane_border_style"
|
||||
setw pane-border-format "$pane_format"
|
||||
|
||||
|
||||
# windows
|
||||
setw window-status-activity-style "fg=${thm_fg},bg=${thm_bg},none"
|
||||
|
|
12
pane/pane_default_format.sh
Normal file
12
pane/pane_default_format.sh
Normal file
|
@ -0,0 +1,12 @@
|
|||
show_pane_default_format() {
|
||||
local number="#{pane_index}"
|
||||
local color="$(get_tmux_option "@catppuccin_pane_color" "$thm_green")"
|
||||
local background="$(get_tmux_option "@catppuccin_pane_background_color" "$thm_gray")"
|
||||
local text="$(get_tmux_option "@catppuccin_pane_default_text" "#{b:pane_current_path}")"
|
||||
local fill="$(get_tmux_option "@catppuccin_pane_default_fill" "number")" # number, all, none
|
||||
local active="#{pane_active}"
|
||||
|
||||
local default_pane_format=$( build_pane_format "$number" "$color" "$background" "$text" "$fill")
|
||||
|
||||
echo "$default_pane_format"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue