Files
dotfiles/.config/polybar/scripts/vpn.sh
Julian Prein 00927c8921 *: Use tabs for indentation where appropriate
I am a big supporter of the approach to indent with tabs and align with
spaces. (Read [here][1] f.e.) Thus at some places a simple `s/ {4}/\t/g`
(replace 4 with whatever fits) is not enough and a bit more thought is
needed. Because of that there are still places where I plan to
substitute the whitespace in the future.

This patch contains exclusively whitespace changes. Check for yourself
with `git diff --ignore-all-space`.

[1]: https://dmitryfrank.com/articles/indent_with_tabs_align_with_spaces
2022-06-23 23:59:01 +02:00

18 lines
360 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