This commit is contained in:
Sabato Luca Guadagno 2021-08-06 21:47:33 +02:00
parent b82a1ca5dc
commit 639433c6f7
2 changed files with 76 additions and 89 deletions

View file

@ -39,16 +39,10 @@ tmux source-file ~/.tmux.conf
## Customizations
### Themes
```bash
# one of: "dracula", "nord"; default: "dracula"
set -g @nova-theme "dracula"
```
### Rows
Define how many status line to show.
```bash
# one of: 0, 1, 2, 3, 4; default: 0
set -g @nova-rows 0
@ -63,12 +57,14 @@ set -g @nova-nerdfonts false
### Pane
Pane content
```bash
# default: "#S:#I:#W"
set -g @nova-pane "#I#{?pane_in_mode,  #{pane_mode},}  #W"
```
### Pane justify
Pane position
```bash
# one of: "left", "right", "centre", "absolute-centre"; default: "left"
@ -77,62 +73,66 @@ set -g @nova-pane-justify "left"
### Segments
Mode segment
```bash
set -g @nova-rows 0
set -g @nova-segment-mode "#{?client_prefix,Ω,ω}"
set -g @nova-segment-mode-colors "#50fa7b #282a36"
set -g @nova-segments-0-left "mode"
```
Whoami segment
```bash
set -g @nova-segment-whoami "#(whoami)@#h"
set -g @nova-segment-whoami-colors "#50fa7b #282a36"
set -g @nova-segments-0-right "whoami"
```
Multiple status bar
[spotify-cli-linux](https://github.com/pwittchen/spotify-cli-linux) segment
```bash
set -g @nova-rows 1
set -g @nova-segments-0-left "mode"
set -g @nova-segments-0-right "whoami"
set -g @nova-segments-1-right "spotify"
set -g @nova-segments-1-left "net"
```
### Custom segments
Define a custom segment using a cli (e.g.: [spotify-cli-liunx](https://github.com/pwittchen/spotify-cli-linux))
```bash
set -g @nova-segment-spotify "#(spotifycli --playbackstatus) #(spotifycli --status)"
set -g @nova-segment-spotify " #(spotifycli --status)"
set -g @nova-segment-spotify-colors "#282a36 #f8f8f2"
set -g @nova-segments-1-left "spotify"
```
Example with [tmux-cpu](https://github.com/tmux-plugins/tmux-cpu)
[tmux-cpu](https://github.com/tmux-plugins/tmux-cpu) segment
```bash
set -g @plugin 'tmux-plugins/tmux-cpu'
set -g @cpu_percentage_format "%5.1f%%"
set -g @cpu_temp_format "%3.0f"
set -g @cpu_temp_unit "C"
set -g @nova-segment-cpu "CPU #(~/.tmux/plugins/tmux-cpu/scripts/cpu_percentage.sh) #(~/.tmux/plugins/tmux-cpu/scripts/cpu_temp.sh)"
set -g @nova-segment-cpu "  #(~/.tmux/plugins/tmux-cpu/scripts/cpu_percentage.sh)"
set -g @nova-segment-cpu-colors "#282a36 #f8f8f2"
set -g @cpu_temp_unit "C"
set -g @cpu_temp_format "%3.0f"
set -g @nova-segment-cpu-temp "#(~/.tmux/plugins/tmux-cpu/scripts/cpu_temp.sh)"
set -g @nova-segment-cpu-temp-colors "#282a36 #f8f8f2"
set -g @ram_percentage_format "%5.1f%%"
set -g @nova-segment-ram "RAM #(~/.tmux/plugins/tmux-cpu/scripts/ram_percentage.sh)"
set -g @nova-segment-ram "#(~/.tmux/plugins/tmux-cpu/scripts/ram_percentage.sh)"
set -g @nova-segment-ram-colors "#282a36 #f8f8f2"
set -g @gpu_percentage_format "%5.1f%%"
set -g @gpu_temp_format "%3.0f"
set -g @gpu_temp_unit "C"
set -g @nova-segment-gpu "GPU #(~/.tmux/plugins/tmux-cpu/scripts/gpu_percentage.sh) #(~/.tmux/plugins/tmux-cpu/scripts/gpu_temp.sh)"
set -g @nova-segment-gpu "﬙  #(~/.tmux/plugins/tmux-cpu/scripts/gpu_percentage.sh)"
set -g @nova-segment-gpu-colors "#282a36 #f8f8f2"
set -g @gpu_temp_unit "C"
set -g @gpu_temp_format "%3.0f"
set -g @nova-segment-gpu-temp "#(~/.tmux/plugins/tmux-cpu/scripts/gpu_temp.sh)"
set -g @nova-segment-gpu-temp-colors "#282a36 #f8f8f2"
set -g @gram_percentage_format "%5.1f%%"
set -g @nova-segment-gram "GRAM #(~/.tmux/plugins/tmux-cpu/scripts/gram_percentage.sh)"
set -g @nova-segment-gram "#(~/.tmux/plugins/tmux-cpu/scripts/gram_percentage.sh)"
set -g @nova-segment-gram-colors "#282a36 #f8f8f2"
set -g @nova-segments-1-right "cpu ram gpu gram"
set -g @nova-segments-1-right "cpu ram cpu-temp gpu gram gpu-temp"
```
Example with [tmux-net-speed](https://github.com/tmux-plugins/tmux-net-speed)
[tmux-net-speed](https://github.com/tmux-plugins/tmux-net-speed) segment
```bash
set -g @net_speed_interfaces "enp6s0"
@ -142,3 +142,22 @@ set -g @nova-segment-net-colors "#282a36 #f8f8f2"
set -g @nova-segments-2-left "net"
```
### Nord theme
```bash
set -g "@nova-pane-active-border-style" "#44475a"
set -g "@nova-pane-border-style" "#282a36"
set -g "@nova-status-style-bg" "#4c566a"
set -g "@nova-status-style-fg" "#d8dee9"
set -g "@nova-status-style-active-bg" "#89c0d0"
set -g "@nova-status-style-active-fg" "#2e3540"
set -g "@nova-status-style-double-bg" "#2d3540"
set -g @nova-segment-mode "#{?client_prefix,Ω,ω}"
set -g @nova-segment-mode-colors "#78a2c1 #2e3440"
set -g @nova-segment-whoami "#(whoami)@#h"
set -g @nova-segment-whoami-colors "#78a2c1 #2e3440"
```

View file

@ -32,38 +32,6 @@ else
tmux set-option -g status $(expr $rows + 1)
fi
#
# themes
#
theme=$(get_option "@nova-theme" "dracula")
if [ $theme = "dracula" ]; then
upsert_option "@nova-pane-active-border-style" "#44475a"
upsert_option "@nova-pane-border-style" "#282a36"
upsert_option "@nova-status-style-bg" "#44475a"
upsert_option "@nova-status-style-fg" "#f8f8f2"
upsert_option "@nova-status-style-active-bg" "#6272a4"
upsert_option "@nova-status-style-active-fg" "#f8f8f2"
upsert_option "@nova-status-style-double-bg" "#282a36"
upsert_option "@nova-segment-mode-colors" "#50fa7b #282a36"
upsert_option "@nova-segment-whoami-colors" "#50fa7b #282a36"
fi
if [ $theme = "nord" ]; then
upsert_option "@nova-pane-active-border-style" "#44475a"
upsert_option "@nova-pane-border-style" "#282a36"
upsert_option "@nova-status-style-bg" "#4c566a"
upsert_option "@nova-status-style-fg" "#d8dee9"
upsert_option "@nova-status-style-active-bg" "#5e81ac"
upsert_option "@nova-status-style-active-fg" "#d8dee9"
upsert_option "@nova-status-style-double-bg" "#2e3440"
upsert_option "@nova-segment-mode-colors" "#50fa7b #282a36"
upsert_option "@nova-segment-whoami-colors" "#50fa7b #282a36"
fi
#
# interval
#
@ -75,35 +43,35 @@ tmux set-option -g interval $interval
# status-style
#
status_style_bg=$(get_option "@nova-status-style-bg")
status_style_fg=$(get_option "@nova-status-style-fg")
status_style_active_bg=$(get_option "@nova-status-style-active-bg")
status_style_active_fg=$(get_option "@nova-status-style-active-fg")
status_style_bg=$(get_option "@nova-status-style-bg" "#44475a")
status_style_fg=$(get_option "@nova-status-style-fg" "#f8f8f2")
status_style_active_bg=$(get_option "@nova-status-style-active-bg" "#6272a4")
status_style_active_fg=$(get_option "@nova-status-style-active-fg" "#f8f8f2")
tmux set-option -g status-style "bg=$status_style_bg,fg=$status_style_fg"
#
# pane
#
pane_border_style=$(get_option "@nova-pane-border-style")
pane_active_border_style=$(get_option "@nova-pane-active-border-style")
pane_border_style=$(get_option "@nova-pane-border-style" "#282a36")
pane_active_border_style=$(get_option "@nova-pane-active-border-style" "#44475a")
tmux set-option -g pane-border-style "fg=${pane_border_style}"
tmux set-option -g pane-active-border-style "fg=${pane_active_border_style}"
#
# segments-left
# segments-0-left
#
segments_left=$(get_option "@nova-segments-0-left" "mode")
segments_left=$(get_option "@nova-segments-0-left" "")
IFS=' ' read -r -a segments_left <<< $segments_left
tmux set-option -g status-left ""
for segment in "${segments_left[@]}"; do
segment_content=$(get_option "@nova-segment-$segment" "")
segment_colors=$(get_option "@nova-segment-$segment-colors")
segment_content=$(get_option "@nova-segment-$segment" "mode")
segment_colors=$(get_option "@nova-segment-$segment-colors" "#282a36 #f8f8f2")
IFS=' ' read -r -a segment_colors <<< $segment_colors
if [ "$segment" != "" ] && [ "$segment_colors" != "" ]; then
if [ "$segment_content" != "" ]; then
if [ $nerdfonts = true ] && [ -n "$(tmux show-option -gqv status-left)" ]; then
tmux set-option -ga status-left "#[fg=${nerdfonts_color},bg=#${segment_colors[0]}]"
tmux set-option -ga status-left "$nerdfonts_left"
@ -156,17 +124,17 @@ if [ $nerdfonts = true ]; then
fi
#
# segments-right
# segments-0-right
#
segments_right=$(get_option "@nova-segments-0-right" "whoami")
segments_right=$(get_option "@nova-segments-0-right" "")
IFS=' ' read -r -a segments_right <<< $segments_right
tmux set-option -g status-right ""
for segment in "${segments_right[@]}"; do
segment_content=$(get_option "@nova-segment-$segment" "")
segment_colors=$(get_option "@nova-segment-$segment-colors")
segment_colors=$(get_option "@nova-segment-$segment-colors" "#282a36 #f8f8f2")
IFS=' ' read -r -a segment_colors <<< $segment_colors
if [ "$segment_content" != "" ] && [ "$segment_colors" != "" ]; then
if [ $nerdfonts = true ] && [ ! -n "$(tmux show-option -gqv status-right)" ]; then
@ -189,10 +157,10 @@ done
for ((row=1; row <= rows; row++)); do
#
# segments-bottom-left
# segments-n-left
#
status_style_double_bg=$(get_option "@nova-status-style-double-bg")
status_style_double_bg=$(get_option "@nova-status-style-double-bg" "#282a36")
segments_bottom_left=$(get_option "@nova-segments-$row-left" "")
IFS=' ' read -r -a segments_bottom_left <<< $segments_bottom_left
@ -201,9 +169,9 @@ for ((row=1; row <= rows; row++)); do
for segment in "${segments_bottom_left[@]}"; do
segment_content=$(get_option "@nova-segment-$segment" "")
segment_colors=$(get_option "@nova-segment-$segment-colors")
segment_colors=$(get_option "@nova-segment-$segment-colors" "#282a36 #f8f8f2")
IFS=' ' read -r -a segment_colors <<< $segment_colors
if [ "$segment_content" != "" ] && [ "$segment_colors" != "" ]; then
if [ "$segment_content" != "" ]; then
if [ $nerdfonts = true ] && [ "$(tmux show-option -gqv status-format[$row])" != "#[align=left]"]; then
tmux set-option -ga status-format[$row] "#[fg=${nerdfonts_color},bg=#${segment_colors[0]}]"
tmux set-option -ga status-format[$row] "$nerdfonts_left"
@ -224,7 +192,7 @@ for ((row=1; row <= rows; row++)); do
fi
#
# segments-bottom-right
# segments-n-right
#
nerdfonts_color="$status_style_double_bg"
@ -235,11 +203,11 @@ for ((row=1; row <= rows; row++)); do
tmux set-option -ga status-format[$row] "#[align=right]"
for segment in "${segments_bottom_right[@]}"; do
segment_content=$(get_option "@nova-segment-$segment" "")
segment_colors=$(get_option "@nova-segment-$segment-colors")
segment_content=$(get_option "@nova-segment-$segment")
segment_colors=$(get_option "@nova-segment-$segment-colors" "#282a36 #f8f8f2")
IFS=' ' read -r -a segment_colors <<< $segment_colors
if [ "$segment" != "" ] && [ "$segment_colors" != "" ]; then
if [ "$segment_content" != "" ]; then
if [ $nerdfonts = true ]; then
tmux set-option -ga status-format[$row] "#[fg=${segment_colors[0]},bg=#${nerdfonts_color}]"
tmux set-option -ga status-format[$row] "$nerdfonts_right"