internet script more efficient

This commit is contained in:
Luke Smith 2020-03-22 09:08:05 -04:00
parent 54f22aab7b
commit 1f24837952
No known key found for this signature in database
GPG key ID: 4C50B54A911F6252

View file

@ -10,8 +10,7 @@ case $BLOCK_BUTTON in
" ;;
esac
[ "$(cat /sys/class/net/w*/operstate)" = 'down' ] && wifiicon="📡"
[ "$(cat /sys/class/net/w*/operstate)" = 'down' ] && wifiicon="📡" ||
wifiicon=$(grep "^\s*w" /proc/net/wireless | awk '{ print "📶", int($3 * 100 / 70) "%" }')
[ ! -n "${wifiicon+var}" ] && wifiicon=$(grep "^\s*w" /proc/net/wireless | awk '{ print "📶", int($3 * 100 / 70) "%" }')
printf "%s %s\n" "$wifiicon" "$(cat /sys/class/net/e*/operstate | sed "s/down/❎/;s/up/🌐/")"
printf "%s %s\n" "$wifiicon" "$(sed "s/down/❎/;s/up/🌐/" /sys/class/net/e*/operstate)"