summary refs log tree commit diff
path: root/.config/waybar/modules/vpn.sh
blob: 4fc5bdd1399bfc4906d4885fc158468ad9d427f4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh

set -e
[ -n "$DEBUG" ] && set -x

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 '{}\n'
fi