diff options
| author | Luke Smith <luke@lukesmith.xyz> | 2020-05-06 19:54:42 -0400 |
|---|---|---|
| committer | Luke Smith <luke@lukesmith.xyz> | 2020-05-06 19:54:42 -0400 |
| commit | 14fde603b7d85897b0322c3674bf494ae0346573 (patch) | |
| tree | 2f6e429f99edb9edf709a1634ade2af2a700104c /.local | |
| parent | f08f4b0b7f8bf4c569f679f301313d563406b851 (diff) | |
| download | eibhear-14fde603b7d85897b0322c3674bf494ae0346573.tar.gz eibhear-14fde603b7d85897b0322c3674bf494ae0346573.tar.zst eibhear-14fde603b7d85897b0322c3674bf494ae0346573.zip | |
fix for no wifi, use case statement
Diffstat (limited to '.local')
| -rwxr-xr-x | .local/bin/statusbar/internet | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/.local/bin/statusbar/internet b/.local/bin/statusbar/internet index 518d6d7..6fcd291 100755 --- a/.local/bin/statusbar/internet +++ b/.local/bin/statusbar/internet @@ -13,7 +13,9 @@ case $BLOCK_BUTTON in " ;; esac -grep -q "down" /sys/class/net/w*/operstate && wifiicon="📡" || - wifiicon="$(grep "^\s*w" /proc/net/wireless | awk '{ print "📶", int($3 * 100 / 70) "%" }')" +case "$(cat /sys/class/net/w*/operstate 2>/dev/null)" in + down) wifiicon="📡 " ;; + up) wifiicon="$(awk '/^\s*w/ { print "📶", int($3 * 100 / 70) "% " }' /proc/net/wireless)" ;; +esac -printf "%s %s\n" "$wifiicon" "$(sed "s/down/❎/;s/up/🌐/" /sys/class/net/e*/operstate)" +printf "%s%s\n" "$wifiicon" "$(sed "s/down/❎/;s/up/🌐/" /sys/class/net/e*/operstate 2>/dev/null)" |
