i3wifi added

This commit is contained in:
Luke Smith
2018-08-01 20:38:48 -04:00
parent 7505f32ebe
commit 0baf312a0a
2 changed files with 31 additions and 7 deletions

25
.scripts/i3wifi Executable file
View File

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