Skip to content

Commit

Permalink
add net to status_right
Browse files Browse the repository at this point in the history
  • Loading branch information
HarHarLinks authored and Kim Brose committed Mar 22, 2018
1 parent 0ddafa7 commit 558d591
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ This plugin has the following optional dependencies:
- [Tmux prefix highlight](https://github.com/tmux-plugins/tmux-prefix-highlight)
- [Tmux Battery](https://github.com/tmux-plugins/tmux-battery)
- [Tmux CPU](https://github.com/tmux-plugins/tmux-cpu)
- [Tmux Net speed](https://github.com/tmux-plugins/tmux-net-speed)

See [installing TPM plugins](https://github.com/tmux-plugins/tpm#installing-plugins).

Expand Down Expand Up @@ -57,6 +58,7 @@ set -g @tpm_plugins ' \
tmux-plugins/tmux-battery \
tmux-plugins/tmux-cpu \
tmux-plugins/tmux-prefix-highlight \
tmux-plugins/tmux-net-speed \
'

# Initialize TMUX plugin manager
Expand Down
21 changes: 17 additions & 4 deletions maglev.tmux
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ SHOW_BATTERY=false
if [[ $PLUGINS == *"tmux-battery"* ]]; then
SHOW_BATTERY=true
fi
SHOW_NET=false
if [[ $PLUGINS == *"tmux-net-speed"* ]]; then
SHOW_NET=true
fi

# Battery icons
tmux set -g @batt_charged_icon "︎♡"
Expand Down Expand Up @@ -147,24 +151,33 @@ apply_theme() {
status_right="︎#[fg=$time_date_fg,nobold]#{prefix_highlight} $right_separator %R $right_separator %a %d %b #[fg=$host_bg]"

# Only show solid separator if CPU or Battery are to be displayed
if [ "$SHOW_BATTERY" = true ] || [ "$SHOW_CPU" = true ]; then
if [ "$SHOW_BATTERY" = true ] || [ "$SHOW_NET" = true ] || [ "$SHOW_CPU" = true ]; then
status_right="$status_right $right_separator_black#[fg=$host_fg,bg=$host_bg,bold]"
fi

if [ "$SHOW_BATTERY" = true ]; then
status_right="$status_right #{battery_icon} #{battery_percentage}"
fi

# Only add intermediate separator if both CPU and Batter are to be displayed
if [ "$SHOW_BATTERY" = true ] && [ "$SHOW_CPU" = true ]; then
# Only add intermediate separator if both battery and network are to be displayed
if [ "$SHOW_BATTERY" = true ] && [ "$SHOW_NET" = true ]; then
status_right="$status_right $right_separator"
fi

if [ "$SHOW_NET" = true ]; then
status_right="$status_right  #{net_speed} "
fi

# Only add intermediate separator if both and CPU are to be displayed
if ([ "$SHOW_BATTERY" = true ] || [ "$SHOW_NET" = true ]) && [ "$SHOW_CPU" = true ]; then
status_right="$status_right $right_separator"
fi

if [ "$SHOW_CPU" = true ]; then
status_right="$status_right CPU #{cpu_percentage} "
fi

tmux set -g status-right-length 64 \; set -g status-right "$status_right"
tmux set -g status-right-length 80 \; set -g status-right "$status_right"

# clock
clock_mode_colour=colour4 # blue
Expand Down

0 comments on commit 558d591

Please sign in to comment.