diff --git a/hosts/pinwheel/modules/waybar/default.nix b/hosts/pinwheel/modules/waybar/default.nix index 21109b0..d8550d1 100644 --- a/hosts/pinwheel/modules/waybar/default.nix +++ b/hosts/pinwheel/modules/waybar/default.nix @@ -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 }