diff options
-rw-r--r-- | i3status.conf | 16 | ||||
-rwxr-xr-x | install | 23 |
2 files changed, 35 insertions, 4 deletions
diff --git a/i3status.conf b/i3status.conf index 0f96e5e..cd32b2f 100644 --- a/i3status.conf +++ b/i3status.conf @@ -6,22 +6,30 @@ general { interval = 5 } -order += "wireless wlan0" -order += "ethernet eth0" +__DEF__WIFI_START__ +order += "wireless __NIF_WIFI__" +__DEF__WIFI_END__ +__DEF__ETH_START__ +order += "ethernet __NIF_ETH__" +__DEF__ETH_END__ order += "battery 0" order += "load" order += "volume master" order += "tztime local" -wireless wlan0 { +__DEF__WIFI_START__ +wireless __NIF_WIFI__ { format_up = "W: (%quality at %essid, %bitrate) %ip" format_down = "W: down" } +__DEF__WIFI_END__ -ethernet eth0 { +__DEF__ETH_START__ +ethernet __NIF_ETH__ { format_up = "E: %ip (%speed)" format_down = "E: down" } +__DEF__ETH_END__ battery 0 { # show battery capacity in relation to last full capacity instead of the design capacity @@ -153,6 +153,29 @@ function i3statusConfigInstaller() { return 1 fi cp i3status.conf $i3_status_conf + + local nif=$(ip link show | grep ^[1-9] | grep -v LOOPBACK | sed 's/ //g' | cut -d ':' -f 2) + + local num_wlanif=$(echo -e $nif | tr ' ' '\n' | grep wl | wc -l) + local wlanif=$(echo -e $nif | tr ' ' '\n' | grep wl) + if [[ $num_wlanif != 1 || -z $wlanif ]]; then + echo "[Warning]: i3statusConfigInstaller couldn't find name of WIFI IF!" + sed -i '/__DEF__WIFI_START__/,/__DEF__WIFI_END__/d' $i3_status_conf + else + sed -i "s/__NIF_WIFI__/$wlanif/g" $i3_status_conf + fi + + local num_ethif=$(echo -e $nif | tr ' ' '\n' | grep en | wc -l) + local ethif=$(echo -e $nif | tr ' ' '\n' | grep en) + if [[ $num_ethif != 1 || -z $ethif ]]; then + echo "[Warning]: i3statusConfigInstaller couldn't find name of ETH IF!" + sed -i '/__DEF__ETH_START__/,/__DEF__ETH_END__/d' $i3_status_conf + else + sed -i "s/__NIF_ETH__/$ethif/g" $i3_status_conf + fi + + sed -i '/__DEF__.*__/d' $i3_status_conf + return 0 } |