Merge pull request #25 from Baitinq/master

Update WIFI module so that it doesnt show the icon when not connected to wifi
This commit is contained in:
Baitinq 2021-10-21 13:36:05 +01:00 committed by GitHub
commit b7c7f3f594
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5,13 +5,15 @@
WIFI_FULL_ICON='' WIFI_FULL_ICON=''
WIFI_MID_ICON='' WIFI_MID_ICON=''
WIFI_LOW_ICON='' WIFI_LOW_ICON=''
NO_WIFI_ICON=''
get_wifi() get_wifi()
{ {
if grep -q wl* "/proc/net/wireless"; then if grep -q wl* "/proc/net/wireless"; then
# Wifi quality percentage # Wifi quality percentage
percentage=$(grep "^\s*w" /proc/net/wireless | awk '{ print "", int($3 * 100 / 70)}'| xargs) percentage=$(grep "^\s*w" /proc/net/wireless | awk '{ print "", int($3 * 100 / 70)}'| xargs)
case $percentage in case $percentage in
0) echo $NO_WIFI_ICON;;
100|9[0-9]|8[0-9]|7[0-9]) echo "$WIFI_FULL_ICON" ;; 100|9[0-9]|8[0-9]|7[0-9]) echo "$WIFI_FULL_ICON" ;;
6[0-9]|5[0-9]|4[0-9]|3[0-9]) echo "$WIFI_MID_ICON" ;; 6[0-9]|5[0-9]|4[0-9]|3[0-9]) echo "$WIFI_MID_ICON" ;;
2[0-9]|1[0-9]|[0-9]) echo "$WIFI_LOW_ICON" ;; 2[0-9]|1[0-9]|[0-9]) echo "$WIFI_LOW_ICON" ;;
@ -20,4 +22,3 @@ get_wifi()
} }
get_wifi get_wifi