commit 08237738dd41f79dae4f0b552def8e86ffafdcf4 parent fd287e0cd9ec18de467fa78b856785b14fcaf3a2 Author: Oscar Benedito <oscar@oscarbenedito.com> Date: Sun, 28 Jun 2020 21:09:11 +0200 Add internet script for dwmblocks Diffstat:
A | .local/bin/dwmblocks/dwmb-internet | | | 11 | +++++++++++ |
1 file changed, 11 insertions(+), 0 deletions(-)
diff --git a/.local/bin/dwmblocks/dwmb-internet b/.local/bin/dwmblocks/dwmb-internet @@ -0,0 +1,11 @@ +#!/usr/bin/env sh + +# Show wifi 📶 and percent strength or 📡 if none. +# Show 🌐 if connected to ethernet or ❎ if none. + +case "$(cat /sys/class/net/w*/operstate 2>/dev/null)" in + down) wifiicon="📡 " ;; + up) wifiicon="$(awk '/^\s*w/ { print "📶", int($3 * 100 / 70) "% " }' /proc/net/wireless)" ;; +esac + +printf "%s%s\n" "$wifiicon" "$(sed "s/down/❎/;s/up/🌐/" /sys/class/net/e*/operstate 2>/dev/null)"