fix for no wifi, use case statement

This commit is contained in:
Luke Smith 2020-05-06 19:54:42 -04:00
parent f08f4b0b7f
commit 14fde603b7
No known key found for this signature in database
GPG key ID: 4C50B54A911F6252

View file

@ -13,7 +13,9 @@ case $BLOCK_BUTTON in
" ;; " ;;
esac esac
grep -q "down" /sys/class/net/w*/operstate && wifiicon="📡" || case "$(cat /sys/class/net/w*/operstate 2>/dev/null)" in
wifiicon="$(grep "^\s*w" /proc/net/wireless | awk '{ print "📶", int($3 * 100 / 70) "%" }')" 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)"