Small changes in vpn polybar module
Check for tunnel connections now as well. Add exit code that signals if a VPN is used or not.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
connection="$(nmcli con show --active | awk '$3 == "vpn" { print $1 }')"
|
||||
connection="$(nmcli con show --active | awk '$3 ~ /^(vpn|tun)$/ { print $1 }')"
|
||||
if [ -n "$connection" ]; then
|
||||
echo "VPN: $connection"
|
||||
exit 0
|
||||
@@ -8,6 +8,10 @@ fi
|
||||
|
||||
# [o] is a hack to not grep the grep-command
|
||||
# see: https://stackoverflow.com/questions/9375711/more-elegant-ps-aux-grep-v-grep
|
||||
! ps ax | grep -q "[o]penvpn" || echo -n "VPN"
|
||||
if ps ax | grep -q "[o]penvpn"; then
|
||||
echo "VPN"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo
|
||||
exit 1
|
||||
|
||||
Reference in New Issue
Block a user