i3wifi primary

This commit is contained in:
Luke Smith 2018-11-04 18:56:54 -05:00
parent 9244feb6ab
commit cd667e6aa1
2 changed files with 4 additions and 21 deletions

View file

@ -64,5 +64,4 @@ interval=30
[wifi]
command=i3wifi
instance=wlp2s0
interval=10

View file

@ -1,25 +1,9 @@
#!/bin/bash
#!/bin/sh
case $BLOCK_BUTTON in
1) $TERMINAL -e sudo -A wifi-menu ;;
1) $TERMINAL -e nmtui ;;
esac
INTERFACE="${BLOCK_INSTANCE:-wlan0}"
[ "$(cat /sys/class/net/w*/operstate)" = 'down' ] && echo 📡 && exit
[[ "$(cat /sys/class/net/$INTERFACE/operstate)" = 'down' ]] && echo 📡 && exit
QUALITY=$(grep $INTERFACE /proc/net/wireless | awk '{ print int($3 * 100 / 70 - 1) }')
echo 📶 $QUALITY%
echo 📶 $QUALITY%
# color
if [[ $QUALITY -ge 80 ]]; then
echo "#00FF00"
elif [[ $QUALITY -lt 40 ]]; then
echo "#FF0000"
elif [[ $QUALITY -lt 60 ]]; then
echo "#FF8000"
elif [[ $QUALITY -lt 80 ]]; then
echo "#FFF600"
fi
grep ^w /proc/net/wireless | awk '{ print "📶", int($3 * 100 / 70) "%" }'