pinwheel: Name the exit node in the tailscale connect notification

The notification shows the exit node's hostname, followed by its city
and country when tailscale knows the node's location.
This commit is contained in:
Alexander Heldt committed 2026-11-15 15:49:20 +01:00
1 parent b5a1bdb36f
commit 42247d2ccd
1 file changed
+6 -1
+6 -1
View File
@@ -75,7 +75,12 @@ let
if [ "$EXIT_NODE_ONLINE" == "true" ]; then
tailscale set --exit-node="" && ${pkgs.libnotify}/bin/notify-send "Disconnected from Exit Node"
else
tailscale set --exit-node=$PREFERRED_EXIT_NODE && ${pkgs.libnotify}/bin/notify-send "Connected to Exit Node"
tailscale set --exit-node=$PREFERRED_EXIT_NODE || exit 1
EXIT_NODE_NAME=$(tailscale status --json | ${pkgs.jq}/bin/jq -r '
.Peer.[] | select(.ExitNode)
| .HostName + (if .Location then " (\(.Location.City), \(.Location.Country))" else "" end)')
${pkgs.libnotify}/bin/notify-send "Connected to Exit Node" "$EXIT_NODE_NAME"
fi
}