mirror of
https://git.adityakumar.xyz/dwmbar.git
synced 2024-11-13 23:49:43 +00:00
23 lines
641 B
Bash
Executable file
23 lines
641 B
Bash
Executable file
#!/bin/bash
|
|
|
|
# Gets the wifi status
|
|
|
|
WIFI_FULL_ICON=''
|
|
WIFI_MID_ICON=''
|
|
WIFI_LOW_ICON=''
|
|
|
|
get_wifi()
|
|
{
|
|
if grep -q wlan* "/proc/net/wireless"; then
|
|
# 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
|
|
}
|
|
|
|
get_wifi
|
|
|