You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
dotfiles/bin/vpn_status.sh

29 lines
694 B
Bash

2 years ago
#!/usr/bin/env bash
# checks mullvad status for monitoring in polybar
CONNECTED=$(printf '%s%s' '%{F#0F0}' $(echo -e '\Uf0318')) # green
DISCONNECTED=$(printf '%s%s' '%{F#F00}' $(echo -e '\Uf0319')) # red
# check that its installed
if ! command -v mullvad &>/dev/null ; then
echo "Seafile not downloaded to device!">&2
echo "$DISCONNECTED"
exit 1
fi
# reading vpn status as continous output
while read VPN_STATUS; do
2 years ago
VPN_DISCONNECTED=$(echo "$VPN_STATUS" | grep Disconnect);
if [[ -n "$VPN_DISCONNECTED" ]] ; then
# vpn is disconnected
echo "$DISCONNECTED"
continue
fi
2 years ago
# connected
echo "$CONNECTED"
done < <(mullvad status listen)