dotfiles/dot_local/bin/executable_mullvad-status

14 lines
416 B
Bash

#!/usr/bin/env bash
while read -r LINE; do
if echo "$LINE" | grep -q 'Connected'; then
# get the relay (3rd word) | drop the wireguard/openvpn suffix | make it uppercase
# just replace this with whatever style you like
OUTPUT=$(echo "$LINE" | cut -d " " -f 3 | cut -d "-" -f 1 | tr '/a-z/' '/A-Z/')
ICON=" "
else
ICON=" "
fi
echo "$ICON" "$OUTPUT"
done < <(mullvad status listen)