#!/bin/bash [ -f "${HOME}/.local/state/.vpn_loading" ] && { echo 'Loading...' exit 0 } PIPE="/var/run/vpnd.sock" send_cmd() { [ -p $PIPE ] && echo "$@" > $PIPE && \ cat < $PIPE } IFNAME="$(send_cmd status)" case "$IFNAME" in "msk") IFNAME="Moscow";; "rix") IFNAME="Riga";; esac if [ -n "$IFNAME" ]; then echo "󰦝 $IFNAME" exit 0 fi DEFAULT_LINK="$(resolvectl status | grep 'Default Route: yes' -B10 | grep 'Link' | tail -1 | grep -Eo '\(.*\)' | tr -d '()')" if resolvectl domain "$DEFAULT_LINK" | grep -q 'wzray.com'; then [ "$(ssh router vpn status laptop 2>/dev/null)" = '1' ] && echo "󰦝 Local" fi