summaryrefslogtreecommitdiffstats
path: root/.scripts
diff options
context:
space:
mode:
authorLuke Smith <luke@lukesmith.xyz>2018-08-01 20:38:48 -0400
committerLuke Smith <luke@lukesmith.xyz>2018-08-01 20:38:48 -0400
commit0baf312a0afa1a1b2dec3be1164ccd480b64737a (patch)
treeaf35eb96d1f0a116c420736a7327f79d8fa12eeb /.scripts
parent7505f32ebe34b30fcb56ad8d5a2f14da2935e595 (diff)
downloadeibhear-0baf312a0afa1a1b2dec3be1164ccd480b64737a.tar.gz
eibhear-0baf312a0afa1a1b2dec3be1164ccd480b64737a.tar.zst
eibhear-0baf312a0afa1a1b2dec3be1164ccd480b64737a.zip
i3wifi added
Diffstat (limited to '.scripts')
-rwxr-xr-x.scripts/i3wifi25
1 files changed, 25 insertions, 0 deletions
diff --git a/.scripts/i3wifi b/.scripts/i3wifi
new file mode 100755
index 0000000..3fe5fb0
--- /dev/null
+++ b/.scripts/i3wifi
@@ -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