Add wifi and iface i3block

This commit is contained in:
Riyyi
2018-01-19 10:24:32 +01:00
parent 08d66fd4e2
commit 1ffefb6364
2 changed files with 30 additions and 0 deletions
+13
View File
@@ -0,0 +1,13 @@
#!/bin/sh
WIRED="${BLOCK_INSTANCE:-eth0}"
echo ""
echo ""
if [ ! -d /sys/class/net/${WIRED} ] ||
[ "$(cat /sys/class/net/$WIRED/operstate)" = 'down' ] ||
[ "$(ip a | grep $WIRED | awk '/inet / {print $2}')" = "" ]; then
echo "#676E7D"
else
echo "#FFFFFF"
fi
+17
View File
@@ -0,0 +1,17 @@
#!/bin/sh
WIRELESS="${BLOCK_INSTANCE:-wlan0}"
if [ ! -d /sys/class/net/${WIRELESS}/wireless ] ||
[ "$(cat /sys/class/net/$WIRELESS/operstate)" = 'down' ]; then
echo ""
echo ""
echo "#676E7D"
else
SSID=$(iw dev $WIRELESS link | awk '/SSID/ { print $2 }')
QUALITY=$(grep $WIRELESS /proc/net/wireless | awk '{ print int($3 * 100 / 70) }')
echo "$SSID$QUALITY%"
echo "$$QUALITY%"
echo "#FFFFFF"
fi