1
0
Fork 0

sb-internet: fixes for wireguard, connman

This commit is contained in:
Luca Bilke 2024-07-08 11:36:25 +02:00
parent d6f6bdd26d
commit 65c3ac6ef2
Signed by: luca
GPG Key ID: F6E11C9BAA7C82F5
1 changed files with 17 additions and 17 deletions

View File

@ -2,27 +2,27 @@
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
if ls /sys/class/net/wl* 1>/dev/null 2>&1; then
for w in /sys/class/net/wl*/; do
percent="$(grep "$(basename "$(dirname "$w/operstate")")" /proc/net/wireless | tr -s ' ' | cut -d ' ' -f3 | tr -dc "[:digit:]")"
grep -vxq '0x\(1\|9\)003' "$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
if ls /sys/class/net/en* 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
if ls /sys/class/net/wg* 1>/dev/null 2>&1; then
for _ in /sys/class/net/wg*/carrier; do
printf "%b" "$shift󰖂"
shift=" "
done
fi
printf "\n"