summary refs log tree commit diff
path: root/.config/waybar/modules/vpn.sh
diff options
context:
space:
mode:
authorRobert Günzler <r@gnzler.io>2022-09-28 19:36:25 +0200
committerRobert Günzler <r@gnzler.io>2022-09-28 19:36:25 +0200
commitb7c041211b20552acd2fa5a96ccfb444156bb01a (patch)
treee11370fc3cdd28ffd415e60d94fe3084224a9ecc /.config/waybar/modules/vpn.sh
parentd02ebebe68b84b6996bcf7e9e76fdabf0d69e47a (diff)
waybar: replace mullvad module with generic vpn module
can also detect if we use tailscale exit node
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