2022-07-30 07:17:12 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
# path where mullvad is kept
|
|
|
|
PATH=/usr/local/bin:$PATH
|
|
|
|
|
2022-07-31 21:31:57 +02:00
|
|
|
if ! [ -x "$(command -v mullvad)" ]; then
|
|
|
|
sketchybar --set "$NAME" icon=" " label=""
|
|
|
|
fi
|
2022-07-30 07:17:12 +02:00
|
|
|
|
2022-07-31 21:31:57 +02:00
|
|
|
while read -r LINE; do
|
|
|
|
if echo "$LINE" | grep -q 'Connected'; then
|
|
|
|
# regex grep the relay, e.g. se7 for sweden-7
|
|
|
|
OUTPUT=$(echo "$LINE" | grep -oE "\w{2}\d+")
|
2022-07-30 07:17:12 +02:00
|
|
|
ICON=" "
|
|
|
|
else
|
|
|
|
ICON=" "
|
|
|
|
fi
|
|
|
|
|
2022-07-31 21:31:57 +02:00
|
|
|
sketchybar --set "$NAME" icon="$ICON" label="${OUTPUT^^}"
|
|
|
|
done < <(mullvad status listen)
|