summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuke Smith <luke@lukesmith.xyz>2018-11-04 18:56:54 -0500
committerLuke Smith <luke@lukesmith.xyz>2018-11-04 18:56:54 -0500
commitcd667e6aa111c86b40b9e3104605953e9b341332 (patch)
tree0c0b4d00c6a43c66c0b7b36b39ef50072e908852
parent9244feb6abb13377963fce969d35e1c75b7c7389 (diff)
downloadeibhear-cd667e6aa111c86b40b9e3104605953e9b341332.tar.gz
eibhear-cd667e6aa111c86b40b9e3104605953e9b341332.tar.zst
eibhear-cd667e6aa111c86b40b9e3104605953e9b341332.zip
i3wifi primary
-rw-r--r--.config/i3blocks/config1
-rwxr-xr-x.scripts/i3wifi24
2 files changed, 4 insertions, 21 deletions
diff --git a/.config/i3blocks/config b/.config/i3blocks/config
index e5a6cf8..c5de4ed 100644
--- a/.config/i3blocks/config
+++ b/.config/i3blocks/config
@@ -64,5 +64,4 @@ interval=30
[wifi]
command=i3wifi
-instance=wlp2s0
interval=10
diff --git a/.scripts/i3wifi b/.scripts/i3wifi
index b9f79ec..178c88e 100755
--- a/.scripts/i3wifi
+++ b/.scripts/i3wifi
@@ -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) "%" }'