summary refs log tree commit diff
path: root/.config/waybar/modules/vpn.sh
diff options
context:
space:
mode:
Diffstat (limited to '.config/waybar/modules/vpn.sh')
-rwxr-xr-x.config/waybar/modules/vpn.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/.config/waybar/modules/vpn.sh b/.config/waybar/modules/vpn.sh
new file mode 100755
index 0000000..4fc5bdd
--- /dev/null
+++ b/.config/waybar/modules/vpn.sh
@@ -0,0 +1,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