feat: first/last nerdfonts

This commit is contained in:
o0th 2024-01-11 10:45:33 +01:00
parent 02ffc08566
commit c827cd1d8f
2 changed files with 22 additions and 3 deletions

View file

@ -1,4 +1,4 @@
## Documentation
## Documentation
### Pane
@ -99,6 +99,11 @@ set -g @nova-nerdfonts-left 
set -g @nova-nerdfonts-right 
```
```bash
set -g @nova-nerdfonts-first 
set -g @nova-nerdfonts-last 
```
### Rows
Define how many status line to show.
@ -119,4 +124,4 @@ set -g @nova-segment-bright-colors "#282a36 #f8f8f2"
set -g @nova-segments-1-left "bleft"
set -g @nova-segments-1-right "bright"
```
```

View file

@ -84,6 +84,7 @@ IFS=' ' read -r -a segments_left <<< $segments_left
tmux set-option -g status-left ""
first_left_segment=true
first_left_nerdfont=$(get_option "@nova-nerdfonts-first" "")
for segment in "${segments_left[@]}"; do
segment_content=$(get_option "@nova-segment-$segment" "mode")
segment_colors=$(get_option "@nova-segment-$segment-colors" "#282a36 #f8f8f2")
@ -92,6 +93,11 @@ for segment in "${segments_left[@]}"; do
# condition everything on the non emptiness of the evaluated segment
tmux set-option -ga status-left "#{?#{w:#{E:@nova-segment-$segment}},"
if [ $nerdfonts = true ] && [ $first_left_segment = true ]; then
tmux set-option -ga status-left "#[fg=${segment_colors[0]}#,bg=${segment_colors[1]}]"
tmux set-option -ga status-left "$first_left_nerdfont"
fi
if [ $nerdfonts = true ] && [ $first_left_segment = false ]; then
tmux set-option -ga status-left "#[bg=${segment_colors[0]}]"
tmux set-option -ga status-left "$nerdfonts_left"
@ -167,6 +173,9 @@ fi
segments_right=$(get_option "@nova-segments-0-right" "")
IFS=' ' read -r -a segments_right <<< $segments_right
last_right_nerdfont=$(get_option "@nova-nerdfonts-last" "")
last_segment=${segments_right[${#segments_right[@]}-1]}
tmux set-option -g status-right ""
for segment in "${segments_right[@]}"; do
@ -191,6 +200,11 @@ for segment in "${segments_right[@]}"; do
tmux set-option -ga status-right "$segment_content"
tmux set-option -ga status-right "$(padding $padding)"
if [ $nerdfonts = true ] && [ $segment = $last_segment ]; then
tmux set-option -ga status-right "#[fg=${segment_colors[0]}#,bg=${segment_colors[1]}]"
tmux set-option -ga status-right "$last_right_nerdfont"
fi
# set the bg color for the next nerdfonts seperator
[ $nerdfonts = true ] && tmux set-option -ga status-right "#[bg=${segment_colors[0]}]"
@ -298,4 +312,4 @@ for ((row=1; row <= rows; row++)); do
tmux set-option -ga status-format[$row] "$(padding $padding)"
fi
done
done
done