From d3433bc83edb3838d16094984ea75d1d08eecf59 Mon Sep 17 00:00:00 2001 From: druckdev <63563978+druckdev@users.noreply.github.com> Date: Sun, 13 Sep 2020 04:45:15 +0200 Subject: [PATCH] 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. --- .config/polybar/scripts/running-vpn.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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