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

View file

@ -42,12 +42,6 @@ signal=10
[iface]
label=🌐
#instance=wlan0
color=#00FF00
interval=10
[wifi]
label=📶
instance=wlp2s0
interval=10
[battery]
@ -56,5 +50,10 @@ interval=5
[time]
label=📅
command=echo $(date '+%Y %b %d %I:%M%p') 🕓
command=echo $(date '+%Y %b %d (%a) %I:%M%p') 🕓
interval=30
[wifi]
command=i3wifi
instance=wlp2s0
interval=10

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