summary refs log tree commit diff
path: root/.config
diff options
context:
space:
mode:
Diffstat (limited to '.config')
-rw-r--r--.config/waybar/config.jsonc30
-rwxr-xr-x.config/waybar/modules/vpn.sh19
2 files changed, 43 insertions, 6 deletions
diff --git a/.config/waybar/config.jsonc b/.config/waybar/config.jsonc
index d30d87a..ae3f54c 100644
--- a/.config/waybar/config.jsonc
+++ b/.config/waybar/config.jsonc
@@ -104,9 +104,18 @@
     "return-type": "json"
   },
 
+  "custom/hotspots": {
+    "format": "{}",
+    "exec": "$HOME/.config/waybar/modules/hotspots.sh",
+    "on-click": "$HOME/.config/waybar/modules/hotspots.sh click",
+    "escape": true,
+    "interval": 600,
+    "return-type": "json"
+  },
+
   // ------------------------------------------------------------------------ //
   // "modules-right": ["tray", "cpu", "memory", "disk#root", "disk#home", "temperature", "idle_inhibitor", "backlight", "custom/gamma", "pulseaudio", "network#mullvad", "network#tailscale", "network", "battery"],
-  "modules-right": ["tray", "cpu", "memory", "disk#root", "disk#home", "temperature", "idle_inhibitor", "custom/gamma", "pulseaudio", "network#mullvad", "network#tailscale", "network", "battery"],
+  "modules-right": ["tray", "cpu", "memory", "disk#root", "disk#home", "temperature", "idle_inhibitor", "custom/gamma", "pulseaudio", "custom/vpn", "network#tailscale", "network", "battery"],
 
   "tray": {
     "spacing": 10
@@ -206,15 +215,24 @@
     "on-click": "swx -t -F '0.4' pulsemixer"
   },
 
-  "network#mullvad": {
-    "interface": "mlvd*",
-    "format": "󰒃",
-    "tooltip-format": "{ifname}: {bandwidthUpBits} {bandwidthDownBits}",
-    "tooltip-format-disconnected": "disconnected",
+  "custom/vpn": {
+    "exec": "${HOME}/.config/waybar/modules/vpn.sh",
+    "interval": 600,
+    "return-type": "json"
   },
+
+  // "network#mullvad": {
+  //   "interface": "mlvd*",
+  //   "format": "󰒃",
+  //   "format-disconnected": "",
+  //   "tooltip-format": "{ifname}: {bandwidthUpBits} {bandwidthDownBits}",
+  //   "tooltip-format-disconnected": "disconnected",
+  // },
+
   "network#tailscale": {
     "interface": "tailscale0",
     "format": "󰌆",
+    "format-disconnected": "",
     "tooltip-format": "{ifname}: {bandwidthUpBits} {bandwidthDownBits}",
     "tooltip-format-disconnected": "disconnected",
     "on-click": "doas rc-service tailscale start",
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