diff --git a/.config/polybar/scripts/running-vpn.sh b/.config/polybar/scripts/running-vpn.sh index f358f0c..d046e6a 100755 --- a/.config/polybar/scripts/running-vpn.sh +++ b/.config/polybar/scripts/running-vpn.sh @@ -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