fix sb-internet problems with multiple wifi cards (#1008)

This commit is contained in:
Future is FOSS 2021-09-27 19:18:53 +05:30 committed by GitHub
parent 828c052184
commit 162ed8889b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -17,9 +17,10 @@ case $BLOCK_BUTTON in
6) "$TERMINAL" -e "$EDITOR" "$0" ;; 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac esac
case "$(cat /sys/class/net/w*/operstate 2>/dev/null)" in if grep -xq 'up' /sys/class/net/w*/operstate 2>/dev/null ; then
down) [ "$(cat /sys/class/net/w*/flags)" = "0x1002" ] && wifiicon="❌ " || wifiicon="📡 " ;; wifiicon="$(awk '/^\s*w/ { print "📶", int($3 * 100 / 70) "% " }' /proc/net/wireless)"
up) wifiicon="$(awk '/^\s*w/ { print "📶", int($3 * 100 / 70) "% " }' /proc/net/wireless)" ;; elif grep -xq 'down' /sys/class/net/w*/operstate 2>/dev/null ; then
esac grep -xq '0x1003' /sys/class/net/w*/flags && wifiicon="📡 " || wifiicon="❌ "
fi
printf "%s%s%s\n" "$wifiicon" "$(sed "s/down/❎/;s/up/🌐/" /sys/class/net/e*/operstate 2>/dev/null)" "$(sed "s/.*/🔒/" /sys/class/net/tun*/operstate 2>/dev/null)" printf "%s%s%s\n" "$wifiicon" "$(sed "s/down/❎/;s/up/🌐/" /sys/class/net/e*/operstate 2>/dev/null)" "$(sed "s/.*/🔒/" /sys/class/net/tun*/operstate 2>/dev/null)"