aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/dot_config/waybar/executable_snx-vpn-status.sh
diff options
context:
space:
mode:
authorLibravatar sommerfeld <sommerfeld@sommerfeld.dev>2026-05-14 10:58:38 +0100
committerLibravatar sommerfeld <sommerfeld@sommerfeld.dev>2026-05-14 10:58:38 +0100
commitec3fa96850ff534a241f7ebf2e4cdc13efdf3891 (patch)
tree66eb4670d4309d1d1b764befde7e7d15a0ab91f5 /dot_config/waybar/executable_snx-vpn-status.sh
parent0b506ac67c33939732bdd91d39a8a632bcbe0841 (diff)
downloaddotfiles-ec3fa96850ff534a241f7ebf2e4cdc13efdf3891.tar.gz
dotfiles-ec3fa96850ff534a241f7ebf2e4cdc13efdf3891.tar.bz2
dotfiles-ec3fa96850ff534a241f7ebf2e4cdc13efdf3891.zip
feat(waybar): snx-rs VPN status indicator + click toggle
New custom/snx-vpn module sits next to custom/vpn (the wireguard one): - snx-vpn-status.sh shells out to `snxctl status` (timeout 2s) and maps the output to three states: down (grey strikethrough), connecting/MFA (amber), up (green). Tooltip shows the full status block when up. - snx-vpn-toggle.sh disconnects when up, runs snxctl-chromium detached when down (so SAML lands in the flatpak ungoogled-chromium without blocking waybar). Both paths refresh the module via SIGRTMIN+9.
Diffstat (limited to 'dot_config/waybar/executable_snx-vpn-status.sh')
-rw-r--r--dot_config/waybar/executable_snx-vpn-status.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/dot_config/waybar/executable_snx-vpn-status.sh b/dot_config/waybar/executable_snx-vpn-status.sh
new file mode 100644
index 0000000..9088630
--- /dev/null
+++ b/dot_config/waybar/executable_snx-vpn-status.sh
@@ -0,0 +1,20 @@
+#!/bin/sh
+# Waybar custom/snx-vpn module: report the snx-rs (Check Point) tunnel
+# state. `snxctl status` is fast (talks over a local UDS to the daemon)
+# but might briefly stall during connect; cap it with `timeout`.
+
+# Bail out if the daemon socket isn't even there (snx-rs.service stopped).
+out=$(timeout 2 snxctl status 2>/dev/null) || out=
+
+case "$out" in
+ '' | *"Disconnected"*)
+ printf '{"text":"<span color=\\"#928374\\"><s>󰌾 SNX</s></span>","class":"down","tooltip":"snx-rs disconnected — click to connect"}\n'
+ ;;
+ *"Connecting"* | *"MFA pending"*)
+ printf '{"text":"<span color=\\"#fabd2f\\">󰌾 SNX…</span>","class":"connecting","tooltip":"%s"}\n' "$(echo "$out" | head -1)"
+ ;;
+ *)
+ tooltip=$(echo "$out" | sed 's/"/\\"/g' | awk 'BEGIN{ORS="\\n"}{print}')
+ printf '{"text":"<span color=\\"#b8bb26\\">󰌾 SNX</span>","class":"up","tooltip":"%s"}\n' "$tooltip"
+ ;;
+esac