diff --git a/tmux/.tmux.conf b/tmux/.tmux.conf index 6e1afc4..925cdf3 100644 --- a/tmux/.tmux.conf +++ b/tmux/.tmux.conf @@ -119,7 +119,8 @@ bind -n C-S-Right resize-pane -R 1 # set -g status-left '' -set -g status-right '' +set -g status-right-length 140 +set -g status-right '#(~/.dotfiles/tmux/ip_addresses.sh)' set -g status-bg terminal set -g status-fg white diff --git a/tmux/ip_addresses.sh b/tmux/ip_addresses.sh new file mode 100755 index 0000000..5c166c4 --- /dev/null +++ b/tmux/ip_addresses.sh @@ -0,0 +1,8 @@ +for iface in $(ip addr list | awk -F': ' '/^[0-9]/ {print $2}'); do + short=${iface:0:3} + if [ $short = eth ] || [ $short = enp ] || [ $short = eno ] || [ $short = wlp ]; then + ip=$(ip addr show dev $iface 2>/dev/null | awk '$1 == "inet" {split($2, a, "/"); print a[1]}' | xargs | tr ' ' '/') + echo -n "#[bg=blue, fg=colour232, bold] $iface #[bg=default, fg=default, none]" + [ "$ip" = "" ] && echo -n " down " || echo -n " $ip " + fi +done