i3status: Use default route for ethernet address first.

This commit is contained in:
David Tomaschik
2019-06-07 16:15:46 -07:00
parent e325cc3b93
commit 4d2d8c89f6

View File

@@ -45,6 +45,17 @@ function wireless {
} }
function wired { 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 cat <<-EOF
ethernet _first_ { ethernet _first_ {
format_up = "E: %ip" format_up = "E: %ip"