fix(desktop): open default browser on startup (#2095)

Fixes #934

## Summary

The Go desktop binary started its local server and printed the URL,
but never opened a browser automatically.

This PR:

- opens the default browser after the listener successfully binds
- uses the actual runtime URL
- uses a stdlib-only cross-platform launcher
- keeps browser-open failures non-fatal
- adds `--no-browser` for headless/Docker use
- leaves the normal Vite/web development flow unchanged

The listener is created before launching the browser so the browser
cannot race the server startup path.

## Platform behavior

- Windows: `rundll32 url.dll,FileProtocolHandler`
- macOS: `open`
- Linux: `xdg-open`

No shell command strings are used; arguments are passed directly through
`exec.Command`.

## Testing

- `go test ./...`
- `go vet ./...`
- `go build ./...`
- `git diff --check`
- repeated manual Windows startup verification (3 clean runs, confirmed
the
  browser opened and hit the server, no duplicate launches)
- `--no-browser` verification (confirmed no launch attempt occurs)
- non-fatal launcher failure covered by a unit test that injects a
  nonexistent opener binary

macOS/Linux launch paths were not runtime-tested on this Windows machine
—
they follow the standard `open`/`xdg-open` convention used across other
Go
CLIs but are unverified here. The full packaged release flow (`gox`,
`go.rice`, `go-winres`) was not exercised locally.
This commit is contained in:
Nitish Reddy M
2026-08-24 00:28:40 -04:00
committed by GitHub
parent 5c1c3fd8cb
commit 29cf3f1a97
4 changed files with 33 additions and 16 deletions
+1
View File
@@ -9,6 +9,7 @@
### 🐞 Bug fixes
- The map's data listener now fires on tile loads again, so source and vector layer field autocompletion is populated
- The `maputnik` desktop binary now opens the default browser automatically on startup (opt out with `--no-browser`)
- _...Add new stuff here..._
## 3.1.0