18 lines
615 B
Bash
Executable File
18 lines
615 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# Show wifi 📶 and percent strength or 📡 if none.
|
|
# Show 🌐 if connected to ethernet or ❎ if none.
|
|
# Show 🔒 if a vpn connection is active
|
|
|
|
# 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"
|