#!/bin/sh set -e [ -n "$DEBUG" ] && set -x case "$1" in toggle) exit 1 ;; esac extern_ip=$(curl -SsfL http://api.ipify.org/?format=text) vpn_is_up() { case "$extern_ip" in 138.201.245.159) return 0 ;; # hetzner node esac return 1 } if vpn_is_up; then printf '{"text": "󰒃", "tooltip": "external ip is %s"}\n' "$extern_ip" else # printf '{"text": "󰦜", "tooltip": "disconnected"}\n' printf '{}\n' fi