mirror of
https://git.adityakumar.xyz/dwmbar.git
synced 2024-11-09 22:19:45 +00:00
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:
commit
b7c7f3f594
1 changed files with 3 additions and 2 deletions
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue