29 lines
796 B
Bash
Executable File
29 lines
796 B
Bash
Executable File
#!/bin/sh
|
|
|
|
shift=""
|
|
|
|
if ls /sys/class/net/w*/operstate 1>/dev/null 2>&1; then
|
|
for w in /sys/class/net/w*/; do
|
|
percent="$(grep "$(basename "$(dirname "$w/operstate")")" /proc/net/wireless | tr -s ' ' | cut -d ' ' -f3 | tr -dc "[:digit:]")"
|
|
grep -vxq '0x1003' "$w/flags" && wifi_icon="" || wifi_icon="$(sed "s/up//;s/down//;s/dormant//" "$w/operstate" | tr -d "[:space:]")"
|
|
printf "%b" "$shift$wifi_icon $percent"
|
|
shift=" "
|
|
done
|
|
fi
|
|
|
|
if ls /sys/class/net/e*/operstate 1>/dev/null 2>&1; then
|
|
for e in /sys/class/net/e*/operstate; do
|
|
[ "$(cat "$e")" = "up" ] && printf "%b" "$shift"
|
|
shift=" "
|
|
done
|
|
fi
|
|
|
|
if ls /sys/class/net/tun*/operstate 1>/dev/null 2>&1; then
|
|
for _ in /sys/class/net/tun*/operstate; do
|
|
printf "%b" "$shift"
|
|
shift=" "
|
|
done
|
|
fi
|
|
|
|
printf "\n"
|