From 4d2d8c89f62980a27d5bc83aa13b16be6f48e50e Mon Sep 17 00:00:00 2001 From: David Tomaschik Date: Fri, 7 Jun 2019 16:15:46 -0700 Subject: [PATCH] i3status: Use default route for ethernet address first. --- dotfiles/config/i3status/build_config.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/dotfiles/config/i3status/build_config.sh b/dotfiles/config/i3status/build_config.sh index bd29e6d..5f475af 100755 --- a/dotfiles/config/i3status/build_config.sh +++ b/dotfiles/config/i3status/build_config.sh @@ -1,7 +1,7 @@ #!/bin/bash function general { - cat <<-EOF + cat <<-EOF general { colors = true interval = 5 @@ -45,6 +45,17 @@ function wireless { } function wired { + local def_iface="$(ip route get 1.1.1.1 2>&1 | grep -oP 'dev \K\S+')" + if test -n "${def_iface}" ; then + cat <<-EOF + ethernet "${def_iface}" { + format_up = "E: %ip" + format_down = "E: down" + } + order += "ethernet ${def_iface}" + EOF + return 0 + fi cat <<-EOF ethernet _first_ { format_up = "E: %ip" @@ -107,7 +118,7 @@ function battery { } function audio { - cat <<-EOF + cat <<-EOF volume master { format = "♪: %volume" format_muted = "♪: MUTE"