Browse Source

Add wifi and iface i3block

master
Riyyi 7 years ago
parent
commit
1ffefb6364
  1. 13
      .scripts/wm/iface.sh
  2. 17
      .scripts/wm/wifi.sh

13
.scripts/wm/iface.sh

@ -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
.scripts/wm/wifi.sh

@ -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
Loading…
Cancel
Save