diff options
author | Justine Smithies <justine@smithies.me.uk> | 2024-12-16 19:15:16 +0000 |
---|---|---|
committer | Justine Smithies <justine@smithies.me.uk> | 2024-12-16 19:15:16 +0000 |
commit | 997cc38b25ea409748aa944320e5d34d1738cc41 (patch) | |
tree | 03d8f5d01f1cbcf73db459f6d4ea6eaccba8d48c /.config | |
parent | 5af91843ad31b2dabd6488099111301266d8f90a (diff) |
Convert network.sh converted from bash to sh.
Diffstat (limited to '.config')
-rwxr-xr-x | .config/eww/scripts/network.sh | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/.config/eww/scripts/network.sh b/.config/eww/scripts/network.sh index 29396aa..1a09e45 100755 --- a/.config/eww/scripts/network.sh +++ b/.config/eww/scripts/network.sh @@ -1,4 +1,4 @@ -#!/bin/bash +!/bin/sh # This script requires dnsutils aka bind to fetch the WAN IP address @@ -12,27 +12,27 @@ # Show wifi interface name # nmcli connection show --active | grep 'wifi' | awk '{ print $4 }' FS=' ' -function ShowInfo { - if [ "$(nmcli connection show --active | grep -oh "\w*ethernet\w*")" == "ethernet" ]; then - wan="$(dig @resolver4.opendns.com myip.opendns.com +short)" - connection="$(nmcli connection show --active | grep 'ethernet' | awk '{ print $6 }' FS=' '): $(nmcli connection show --active | grep 'ethernet' | awk '{ printf "%s\nLAN IP:",$1 }' FS=' ') $(nmcli -t -f IP4.ADDRESS dev show $(nmcli connection show --active | grep 'ethernet' | awk '{ print $6 }' FS=' ') | awk '{printf "%s\nWAN IP: '$wan'", $2}' FS='[:/]')" - elif [ "$(nmcli connection show --active | grep -oh "\w*wifi\w*")" == "wifi" ]; then - wan="$(dig @resolver4.opendns.com myip.opendns.com +short)" - connection="$(nmcli connection show --active | grep 'wifi' | awk '{ print $4 }' FS=' '): $(nmcli connection show --active | grep 'wifi' | awk '{ printf "%s\nLAN IP:",$1 }' FS=' ') $(nmcli -t -f IP4.ADDRESS dev show $(nmcli connection show --active | grep 'wifi' | awk '{ print $4 }' FS=' ') | awk '{printf "%s/nWAN IP: '$wan'", $2}' FS='[:/]')" - else - connection="No active connection." - fi +ShowInfo() { + # if [ "$(nmcli connection show --active | grep -oh "\w*ethernet\w*")" == "ethernet" ]; then + # wan="$(dig @resolver4.opendns.com myip.opendns.com +short)" + # connection="$(nmcli connection show --active | grep 'ethernet' | awk '{ print $6 }' FS=' '): $(nmcli connection show --active | grep 'ethernet' | awk '{ printf "%s\nLAN IP:",$1 }' FS=' ') $(nmcli -t -f IP4.ADDRESS dev show $(nmcli connection show --active | grep 'ethernet' | awk '{ print $6 }' FS=' ') | awk '{printf "%s\nWAN IP: '$wan'", $2}' FS='[:/]')" + # elif [ "$(nmcli connection show --active | grep -oh "\w*wifi\w*")" == "wifi" ]; then + # wan="$(dig @resolver4.opendns.com myip.opendns.com +short)" + # connection="$(nmcli connection show --active | grep 'wifi' | awk '{ print $4 }' FS=' '): $(nmcli connection show --active | grep 'wifi' | awk '{ printf "%s\nLAN IP:",$1 }' FS=' ') $(nmcli -t -f IP4.ADDRESS dev show $(nmcli connection show --active | grep 'wifi' | awk '{ print $4 }' FS=' ') | awk '{printf "%s/nWAN IP: '$wan'", $2}' FS='[:/]')" + # else + # connection="No active connection." + # fi fyi -i "network-idle" --hint string:x-canonical-private-synchronous:network-status "$connection" } -function IconUpdate() { - if [ "$(nmcli connection show --active | grep -oh "\w*ethernet\w*")" == "ethernet" ]; then +IconUpdate() { + # if [ "$(nmcli connection show --active | grep -oh "\w*ethernet\w*")" == "ethernet" ]; then icon="" - elif [ "$(nmcli connection show --active | grep -oh "\w*wifi\w*")" == "wifi" ]; then - icon="" - else - icon="" - fi + # elif [ "$(nmcli connection show --active | grep -oh "\w*wifi\w*")" == "wifi" ]; then + # icon="" + # else + # icon="" + # fi printf "%s" "$icon" } |