From b39808d847ebe67d23d3a2b84564457f4810aecd Mon Sep 17 00:00:00 2001 From: Bernardo Magri Date: Sat, 11 Jul 2026 18:15:31 +0100 Subject: [PATCH] fix(waybar): VPN tooltip names the active VPN(s) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The shield's tooltip said only 'VPN active' — with both NM VPNs and Tailscale feeding the same indicator, a forgotten tailscaled read as 'the icon is stuck after disconnecting'. List the active NM VPN/WireGuard connection names and/or 'Tailscale' in the tooltip. Verified on hardware (TuringMachine): script exercised with Tailscale up → tooltip 'VPN: Tailscale'; tailscale down → empty output (self-hide). NM name path is the same awk the nomarchy-vpn picker uses. Co-Authored-By: Claude Fable 5 --- modules/home/waybar.nix | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/modules/home/waybar.nix b/modules/home/waybar.nix index bf26257..cedcd56 100644 --- a/modules/home/waybar.nix +++ b/modules/home/waybar.nix @@ -107,15 +107,20 @@ let # VPN indicator — shows a shield when a NetworkManager VPN/WireGuard # connection is active OR Tailscale is up; prints nothing otherwise so the - # module self-hides (like nightlight/updates). Click opens the VPN submenu. + # module self-hides (like nightlight/updates). The tooltip names each + # active VPN (NM connection names, "Tailscale") — without it a forgotten + # tailscaled reads as "the icon is stuck". Click opens the VPN submenu. vpnStatus = pkgs.writeShellScriptBin "nomarchy-vpn-status" '' - active=$(nmcli -t -f TYPE connection show --active 2>/dev/null | grep -Exm1 'vpn|wireguard') + names=$(nmcli -t -f NAME,TYPE connection show --active 2>/dev/null \ + | awk -F: '$2=="vpn"||$2=="wireguard"{print $1}') ts="" if command -v tailscale >/dev/null 2>&1; then - [ "$(tailscale status --json 2>/dev/null | jq -r '.BackendState // empty')" = Running ] && ts=1 + [ "$(tailscale status --json 2>/dev/null | jq -r '.BackendState // empty')" = Running ] && ts=Tailscale fi - [ -n "$active" ] || [ -n "$ts" ] || exit 0 - printf '{"text":"󰦝","tooltip":"VPN active (click to manage)","class":"on"}\n' + [ -n "$names$ts" ] || exit 0 + list=$(printf '%s\n' "$names" "$ts" | grep -v '^$' | paste -sd ', ' -) + tip=$(printf 'VPN: %s\n(click to manage)' "$list" | jq -Rs 'rtrimstr("\n")') + printf '{"text":"󰦝","tooltip":%s,"class":"on"}\n' "$tip" ''; # Health warning — self-gates: prints nothing while nomarchy-doctor