#!/bin/sh # Wifi if [ "$(cat /sys/class/net/w*/operstate 2>/dev/null)" = 'up' ]; then wifiicon="$(awk '/^[[:space:]]*w/ { gsub(/[[:space:]]+/, " "); print " ", int($3 * 100 / 70) "% " }' /proc/net/wireless)" elif [ "$(cat /sys/class/net/w*/operstate 2>/dev/null)" = 'down' ]; then wifiicon=" " fi # Ethernet [ "$(cat /sys/class/net/e*/operstate 2>/dev/null)" = 'up' ] && ethericon="󰛳 " || ethericon="󰅛 " printf "%s%s\n" "$wifiicon" "$ethericon"