Files
dotfiles/.config/polybar/scripts/running-vpn.sh
druckdev d3433bc83e 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.
2020-09-13 04:45:15 +02:00

18 lines
365 B
Bash
Executable File

#!/bin/sh
connection="$(nmcli con show --active | awk '$3 ~ /^(vpn|tun)$/ { print $1 }')"
if [ -n "$connection" ]; then
echo "VPN: $connection"
exit 0
fi
# [o] is a hack to not grep the grep-command
# see: https://stackoverflow.com/questions/9375711/more-elegant-ps-aux-grep-v-grep
if ps ax | grep -q "[o]penvpn"; then
echo "VPN"
exit 0
fi
echo
exit 1