dwmbar/modules/wifi

24 lines
639 B
Text
Raw Normal View History

2019-10-21 19:19:13 +00:00
#!/bin/bash
2019-10-21 19:22:57 +00:00
# Gets the wifi status
2019-10-21 19:19:13 +00:00
WIFI_FULL_ICON=''
WIFI_MID_ICON=''
WIFI_LOW_ICON=''
2019-10-21 19:22:57 +00:00
get_wifi()
2019-10-21 19:19:13 +00:00
{
if grep -q wl* "/proc/net/wireless"; then
2019-10-21 19:19:13 +00:00
# Wifi quality percentage
percentage=$(grep "^\s*w" /proc/net/wireless | awk '{ print "", int($3 * 100 / 70)}'| xargs)
case $percentage in
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" ;;
2[0-9]|1[0-9]|[0-9]) echo "$WIFI_LOW_ICON" ;;
esac
fi
}
2019-10-21 19:22:57 +00:00
get_wifi
2019-10-21 19:19:13 +00:00