2016-11-04 17:50:03 -07:00
|
|
|
#!/usr/bin/env dash
|
|
|
|
|
2016-12-17 00:07:08 -08:00
|
|
|
if [ -z "$(ip link | grep wlp | awk '{print $2}'| sed 's/://' | sed '1!d')" ]; then
|
|
|
|
echo "No wireless device"
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
2016-11-20 17:41:00 -08:00
|
|
|
. $(dirname $0)/../panel-config
|
2016-11-06 16:40:02 -08:00
|
|
|
|
2016-11-04 17:50:03 -07:00
|
|
|
# No wifi interface? Abort!
|
2016-12-17 00:07:08 -08:00
|
|
|
ints=$(find /sys/class/net -maxdepth 2 -type d -iname 'wireless')
|
2016-11-06 16:40:02 -08:00
|
|
|
[ -z "$ints" ] && echo "I${ICON_WIFI0}" && exit
|
2016-11-04 17:50:03 -07:00
|
|
|
|
|
|
|
# Start watching
|
2016-11-20 17:41:00 -08:00
|
|
|
while :; do
|
2016-11-06 16:40:02 -08:00
|
|
|
# SSID=$(iwgetid --raw)
|
2016-11-04 17:50:03 -07:00
|
|
|
signal=$(awk 'NR==3 {print $3}' /proc/net/wireless)
|
2016-11-20 17:41:00 -08:00
|
|
|
case ${signal%?} in
|
2016-11-06 16:40:02 -08:00
|
|
|
100|[6-9][0-9]) icon="${ICON_WIFI3}" ;;
|
|
|
|
[2-5][0-9]) icon="${ICON_WIFI2}" ;;
|
|
|
|
*) icon="${ICON_WIFI1}" ;;
|
|
|
|
esac
|
|
|
|
echo "I$icon"
|
2016-11-04 17:50:03 -07:00
|
|
|
sleep 10
|
|
|
|
done
|
2016-11-20 17:41:00 -08:00
|
|
|
|
|
|
|
# vim:set ft=sh:
|