Resolve #4, double bar

This commit is contained in:
Sabato Luca Guadagno 2021-07-21 09:27:29 +02:00
parent 38a56121f9
commit 90ed619573
7 changed files with 178 additions and 16 deletions

View file

@ -6,31 +6,54 @@
### Installation
Using [tpm](https://github.com/tmux-plugins/tpm)
#### [Tmux Plugin Manager](https://github.com/tmux-plugins/tpm)
Add this line in your `.tmux.conf`
```bash
set -g @plugin 'o0th/tmux-nova'
```
<kbd>Prefix</kbd> + <kbd>I</kbd>
Hit <kbd>Prefix</kbd> + <kbd>I</kbd> to fetch the plugin and source it.
### Customization
#### Manual
Themes
Clone the repository
```bash
git clone git@github.com:o0th/tmux-nova.git ~/.tmux/plugins/tmux-nova
```
Add this line in your `.tmux.con`
```bash
run-shell ~/.tmux/plugins/tmux-nova/nova.tmux
```
Reload TMUX
```bash
tmux source-file ~/.tmux.conf
```
### Customizations
#### Themes
```bash
# one of: "dracula", "nord"; default: "dracula"
set -g @nova-theme "dracula"
```
Justify
#### Justify
```bash
# one of: "left", "right", "centre"; default: "left"
set -g @nova-status-justify "left"
```
Plugins
#### Plugins
```bash
# list from: "mode", "whoami", "spotify"; default: "mode whoami", "spotify"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

24
scripts/cpu.sh Executable file
View file

@ -0,0 +1,24 @@
#!/usr/bin/env bash
export LC_ALL=en_US.UTF-8
scripts="$HOME/.tmux/plugins/tmux-cpu/scripts"
tmux set-option -g @cpu_percentage_format "%5.1f%%"
tmux set-option -g @ram_percentage_format "%5.1f%%"
cpu_temp=$(echo "$($scripts/gpu_temp.sh)" | sed -r 's/[C]+//g')
if [[ $cpu_temp -ge 0 ]] && [[ $cpu_temp -le 24 ]]; then
cpu_thermometer=""
elif [[ $cpu_temp -ge 25 ]] && [[ $cpu_temp -le 49 ]]; then
cpu_thermometer=""
elif [[ $cpu_temp -ge 50 ]] && [[ $cpu_temp -le 74 ]]; then
cpu_thermometer=""
elif [[ $cpu_temp -ge 75 ]] && [[ $cpu_temp -le 99 ]]; then
cpu_thermometer=""
else
cpu_thermometer=""
fi
echo "$($scripts/cpu_percentage.sh)$($scripts/ram_percentage.sh)$cpu_temp糖$cpu_thermometer"

23
scripts/gpu.sh Executable file
View file

@ -0,0 +1,23 @@
#!/usr/bin/env bash
export LC_ALL=en_US.UTF-8
scripts="$HOME/.tmux/plugins/tmux-cpu/scripts"
tmux set-option -g @gpu_percentage_format "%5.1f%%"
tmux set-option -g @gram_percentage_format "%5.1f%%"
gpu_temp=$(echo "$($scripts/gpu_temp.sh)" | sed -r 's/[C]+//g')
if [[ $gpu_temp -ge 0 ]] && [[ $gpu_temp -le 24 ]]; then
gpu_thermometer=""
elif [[ $gpu_temp -ge 25 ]] && [[ $gpu_temp -le 49 ]]; then
gpu_thermometer=""
elif [[ $gpu_temp -ge 50 ]] && [[ $gpu_temp -le 74 ]]; then
gpu_thermometer=""
elif [[ $gpu_temp -ge 75 ]] && [[ $gpu_temp -le 99 ]]; then
gpu_thermometer=""
else
gpu_thermometer=""
fi
echo "$($scripts/gpu_percentage.sh) ﴿ $($scripts/gram_percentage.sh)$gpu_temp糖$gpu_thermometer"

View file

@ -12,6 +12,15 @@ padding=$(option "@nova-padding" 1)
powerline=$(option "@nova-powerline" true)
powerline_right=$(option "@nova-powerline-right")
powerline_left=$(option "@nova-powerline-left")
double=$(option "@nova-double" true)
#
# double
#
if [ $double = "true" ]; then
tmux set-option -g status 2
fi
#
# themes
@ -22,13 +31,16 @@ theme=$(option "@nova-theme" "nord")
if [ $theme = "dracula" ]; then
tmux set-option -g "@nova-pane-active-border-style" "#44475a"
tmux set-option -g "@nova-pane-border-style" "#282a36"
tmux set-option -g "@nova-plugins-mode-colors" "#50fa7b #282a36"
tmux set-option -g "@nova-plugins-whoami-colors" "#6272a4 #f8f8f2"
tmux set-option -g "@nova-plugins-mode-colors" "#8be9fd #282a36"
tmux set-option -g "@nova-plugins-whoami-colors" "#bd93f9 #282a36"
tmux set-option -g "@nova-status-style-bg" "#44475a"
tmux set-option -g "@nova-status-style-fg" "#f8f8f2"
tmux set-option -g "@nova-status-style-active-bg" "#282a36"
tmux set-option -g "@nova-status-style-active-bg" "#6272a4"
tmux set-option -g "@nova-status-style-active-fg" "#f8f8f2"
tmux set-option -g "@nova-plugins-spotify-colors" "#50fa7b #282a36"
tmux set-option -g "@nova-status-style-double-bg" "#282a36"
tmux set-option -g "@nova-plugins-spotify-colors" "#282a36 #f8f8f2"
tmux set-option -g "@nova-plugins-cpu-colors" "#282a36 #f8f8f2"
tmux set-option -g "@nova-plugins-gpu-colors" "#282a36 #f8f8f2"
fi
if [ $theme = "nord" ]; then
@ -38,9 +50,12 @@ if [ $theme = "nord" ]; then
tmux set-option -g "@nova-plugins-whoami-colors" "#81a1c1 #2e3440"
tmux set-option -g "@nova-status-style-bg" "#4c566a"
tmux set-option -g "@nova-status-style-fg" "#d8dee9"
tmux set-option -g "@nova-status-style-active-bg" "#2e3440"
tmux set-option -g "@nova-status-style-active-bg" "#5e81ac"
tmux set-option -g "@nova-status-style-active-fg" "#d8dee9"
tmux set-option -g "@nova-plugins-spotify-colors" "#a3be8c #2e3440"
tmux set-option -g "@nova-status-style-double-bg" "#2e3440"
tmux set-option -g "@nova-plugins-spotify-colors" "#2e3440 #d8dee9"
tmux set-option -g "@nova-plugins-cpu-colors" "#2e3440 #d8dee9"
tmux set-option -g "@nova-plugins-gpu-colors" "#2e3440 #d8dee9"
fi
#
@ -137,8 +152,8 @@ tmux set-window-option -ga window-status-current-format "#S:#I:#W"
tmux set-window-option -ga window-status-current-format "$(padding $padding)"
if [ $powerline = true ]; then
tmux set-window-option -ga window-status-current-format "#[fg=${status_style_bg},bg=${status_style_active_bg}]"
tmux set-window-option -ga window-status-current-format "$powerline_right"
tmux set-window-option -ga window-status-current-format "#[fg=${status_style_active_bg},bg=${status_style_bg}]"
tmux set-window-option -ga window-status-current-format "$powerline_left"
fi
@ -146,12 +161,13 @@ fi
# status-right
#
status_right_plugins=$(option "@nova-status-right-plugins" "spotify")
status_right_plugins=$(option "@nova-status-right-plugins" "")
IFS=' ' read -r -a status_right_plugins <<< $status_right_plugins
tmux set-option -g status-right-length 100
tmux set-option -g status-right ""
for plugin in "${status_right_plugins[@]}"; do
if [ -f "$current_dir/$plugin.sh" ]; then
@ -175,3 +191,71 @@ for plugin in "${status_right_plugins[@]}"; do
fi
done
#
# status-bottom-left
#
status_style_double_bg=$(option "@nova-status-style-double-bg")
status_bottom_left_plugins=$(option "@nova-status-bottom-left-plugins" "spotify")
IFS=' ' read -r -a status_bottom_left_plugins <<< $status_bottom_left_plugins
tmux set-option -g status-format[1] "#[fill=$status_style_double_bg]#[align=left]"
powerline_color="$status_style_double_bg"
for plugin in "${status_bottom_left_plugins[@]}"; do
if [ -f "$current_dir/$plugin.sh" ]; then
plugin_colors=$(option "@nova-plugins-$plugin-colors")
IFS=' ' read -r -a plugin_colors <<< $plugin_colors
if [ $powerline = true ] && [ "$(tmux show-option -gqv status-format[1])" != "#[align=left]"]; then
tmux set-option -ga status-format[1] "#[fg=${powerline_color},bg=#${plugin_colors[0]}]"
tmux set-option -ga status-format[1] "$powerline_left"
fi
tmux set-option -ga status-format[1] "#[fg=${plugin_colors[1]},bg=${plugin_colors[0]}]"
tmux set-option -ga status-format[1] "$(padding $padding)"
tmux set-option -ga status-format[1] "#($current_dir/$plugin.sh)"
tmux set-option -ga status-format[1] "$(padding $padding)"
[ $powerline = true ] && powerline_color="${plugin_colors[0]}"
fi
done
if [ $powerline = true ] && [ ! -z $powerline_color ]; then
tmux set-option -ga status-format[1] "#[fg=${powerline_color},bg=${status_style_double_bg}]"
tmux set-option -ga status-format[1] "$powerline_left"
fi
#
# status-bottom-right
#
powerline_color="$status_style_double_bg"
status_bottom_right_plugins=$(option "@nova-status-bottom-plugins" "cpu gpu")
IFS=' ' read -r -a status_bottom_right_plugins <<< $status_bottom_right_plugins
tmux set-option -ga status-format[1] "#[align=right]"
for plugin in "${status_bottom_right_plugins[@]}"; do
if [ -f "$current_dir/$plugin.sh" ]; then
plugin_colors=$(option "@nova-plugins-$plugin-colors")
IFS=' ' read -r -a plugin_colors <<< $plugin_colors
if [ $powerline = true ]; then
tmux set-option -ga status-format[1] "#[fg=${plugin_colors[0]},bg=#${powerline_color}]"
tmux set-option -ga status-format[1] "$powerline_right"
fi
tmux set-option -ga status-format[1] "#[fg=${plugin_colors[1]},bg=${plugin_colors[0]}]"
tmux set-option -ga status-format[1] "$(padding $padding)"
tmux set-option -ga status-format[1] "#($current_dir/$plugin.sh)"
tmux set-option -ga status-format[1] "$(padding $padding)"
[ $powerline = true ] && powerline_color="${plugin_colors[0]}"
fi
done

8
scripts/ram.sh Executable file
View file

@ -0,0 +1,8 @@
#!/usr/bin/env bash
export LC_ALL=en_US.UTF-8
scripts="$HOME/.tmux/plugins/tmux-cpu/scripts"
set -g @ram_percentage_format "%5.1f%%"
echo "$($scripts/ram_percentage.sh)"

View file

@ -1,5 +1,5 @@
#!/usr/bin/env bash
export LC_ALL=en_US.UTF-8
echo "$(spotifycli --status)"
echo "$(spotifycli --playbackstatus) $(spotifycli --status)"