ENH make network choose default interface

This commit is contained in:
Nathan Dwarshuis 2021-06-17 17:37:44 -04:00
parent 860f54b7ca
commit 8bb8671cc0
2 changed files with 4 additions and 17 deletions

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
iface="$1" cmd="$1"
cmd="$2" iface="$(ip route show default | head -n 1 | awk '{print $5}')"
net_format="%3d" net_format="%3d"

View File

@ -125,21 +125,8 @@ set -g status-right ""
set -g status-right-length 0 set -g status-right-length 0
{{- else }} {{- else }}
# TODO this is super annoying down="#($XDG_CONFIG_HOME/tmux/plugins/network down)"
{{- if eq .chezmoi.hostname "portnoy4prez" }} up="#($XDG_CONFIG_HOME/tmux/plugins/network up)"
iface="enp0s31f6"
{{- else if eq .chezmoi.hostname "mangini4mayor" }}
iface="enp3s0"
{{- else if eq .chezmoi.hostname "harrison4hegemon" }}
iface="eth0"
{{- else if eq .chezmoi.hostname "peart4prez" }}
iface="ens3"
{{- else if eq .chezmoi.hostname "myung4mayor" }}
iface="extern1"
{{- end }}
down="#($XDG_CONFIG_HOME/tmux/plugins/network $iface down)"
up="#($XDG_CONFIG_HOME/tmux/plugins/network $iface up)"
net="NET(↑/↓): $up$down" net="NET(↑/↓): $up$down"
cpu="CPU: #($XDG_CONFIG_HOME/tmux/plugins/cpu_perc)" cpu="CPU: #($XDG_CONFIG_HOME/tmux/plugins/cpu_perc)"
mem="RAM: #($XDG_CONFIG_HOME/tmux/plugins/mem_perc)" mem="RAM: #($XDG_CONFIG_HOME/tmux/plugins/mem_perc)"