add vpn indicator to internet status modul (#796)

for me /sys/class/net/tun*/operstate show unknown in every state, but ./net/tun* only exists, if vpn is on
This commit is contained in:
Astronach 2020-11-14 21:11:08 +01:00 committed by GitHub
parent 3215e7b4bb
commit 97358cfe81
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,6 +2,7 @@
# Show wifi 📶 and percent strength or 📡 if none. # Show wifi 📶 and percent strength or 📡 if none.
# Show 🌐 if connected to ethernet or ❎ if none. # Show 🌐 if connected to ethernet or ❎ if none.
# Show 🔒 if a vpn connection is active
case $BLOCK_BUTTON in case $BLOCK_BUTTON in
1) "$TERMINAL" -e nmtui; pkill -RTMIN+4 dwmblocks ;; 1) "$TERMINAL" -e nmtui; pkill -RTMIN+4 dwmblocks ;;
@ -10,6 +11,7 @@ case $BLOCK_BUTTON in
📶: wifi connection with quality 📶: wifi connection with quality
❎: no ethernet ❎: no ethernet
🌐: ethernet working 🌐: ethernet working
🔒: vpn is active
" ;; " ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;; 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac esac
@ -19,4 +21,4 @@ case "$(cat /sys/class/net/w*/operstate 2>/dev/null)" in
up) wifiicon="$(awk '/^\s*w/ { print "📶", int($3 * 100 / 70) "% " }' /proc/net/wireless)" ;; up) wifiicon="$(awk '/^\s*w/ { print "📶", int($3 * 100 / 70) "% " }' /proc/net/wireless)" ;;
esac esac
printf "%s%s\n" "$wifiicon" "$(sed "s/down/❎/;s/up/🌐/" /sys/class/net/e*/operstate 2>/dev/null)" printf "%s%s%s\n" "$wifiicon" "$(sed "s/down/❎/;s/up/🌐/" /sys/class/net/e*/operstate 2>/dev/null)" "$(sed "s/.*/🔒/" /sys/class/net/tun*/operstate 2>/dev/null)"