fix: launch Windows desktop app on double-click; drop the .bat launcher - #3
fix: launch Windows desktop app on double-click; drop the .bat launcher#3HuggeK wants to merge 1 commit into
Conversation
The released Windows executable is built with `-H windowsgui` (no console) and the `--desktop` flag defaulted to false, so double-clicking `device-simulator.exe` started a hidden HTTP server with no window β the app appeared to do nothing. A generated `Device-Simulator.bat` existed only to pass `--desktop`, which is fragile (antivirus false-positives, console flash, easy to misplace). Gate the `--desktop` default on the `desktop` build tag (new `desktop_mode_on.go` / `desktop_mode_off.go`): desktop release builds (macOS/Linux/Windows, built with `-tags desktop,production`) now default to desktop mode, so launching the executable opens the native window. Server and Docker builds omit the tag and stay headless. `WAILS_DESKTOP` now also accepts `0` to force headless, mirroring `1`. Remove the generated `Device-Simulator.bat` from CI and document running headless with `device-simulator.exe --desktop=false` (web dashboard at http://localhost:8762) in the README, release notes, and CLAUDE.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
miravoss26
left a comment
There was a problem hiding this comment.
Reviewed the diff (build-tag default flip for --desktop, plus docs).
What it does: desktop release builds (compiled with the desktop tag) now default --desktop to true via a build-tag pair (desktop_mode_on.go / desktop_mode_off.go), so double-clicking the Windows .exe opens the native window without the .bat launcher. Server/Docker builds keep defaulting to headless. WAILS_DESKTOP now explicitly supports 0 to force headless (previously only 1 was handled).
Correctness: the two build-tagged files are mutually exclusive (//go:build desktop / //go:build !desktop) so there's no ambiguity at compile time. The WAILS_DESKTOP switch (1/0/anything else) reads right β env overrides flag/default either direction, matches the updated docs. Docs (CLAUDE.md, README, workflow release notes) were updated consistently with the behavior change.
Security: none β no secrets, no new deps, no new network surface, CI-workflow-only + Go flag default change.
Small note, not blocking: statusCheckRollup is empty on this PR (no CI configured to run on it), so I can't confirm the Windows build step itself still compiles clean β worth a manual build check before merge if that job doesn't trigger automatically.
Safe to merge from my read.
Problem
On Windows, double-clicking
device-simulator.exefrom the release zip appears to do nothing β no window opens.Root cause: the released
.exeis built with-H windowsgui(GUI subsystem, no console), and the--desktopflag defaulted tofalse. A double-click therefore started a hidden, headless HTTP server with no window and no console output. The Wails desktop window only appeared when--desktopwas passed β which is why the release shipped aDevice-Simulator.batwhose only job was to add that flag. That.batworkaround is fragile: antivirus false-positives, a console flash, and it's easy to misplace.Fix
Gate the
--desktopdefault on thedesktopbuild tag, via two small files:cmd/simulator/desktop_mode_on.go(//go:build desktop) βdefaultDesktopMode = truecmd/simulator/desktop_mode_off.go(//go:build !desktop) βdefaultDesktopMode = falseThe desktop release builds (macOS/Linux/Windows) already compile with
-tags "desktop,production", so they now default to desktop mode β double-clicking the executable opens the native window, no.batneeded. The Docker image and the*-serverMakefile targets omit the tag and keep defaulting to the headless HTTP server.WAILS_DESKTOPnow also accepts0to force headless (mirroring1).Removed the generated
Device-Simulator.batstep from the Windows CI build.Headless mode (now documented)
The same executable still runs headless:
then browse to http://localhost:8762. Documented in the README, the release notes, and
CLAUDE.md. (Because the released.exeis a GUI build it produces no console output and Ctrl+C won't stop it β control it from the web dashboard, or use Docker /make build-windows-serverfor console logs.)Changes
cmd/simulator/main.goβ flag default is nowdefaultDesktopMode;WAILS_DESKTOPhandles both0and1cmd/simulator/desktop_mode_on.go,desktop_mode_off.goβ build-tag-gated default (new).github/workflows/build.ymlβ drop.batgeneration; update Windows install + headless notesREADME.md,CLAUDE.mdβ document double-click launch and--desktop=falseheadless modeVerification
go test ./...passes-tags "desktop,production" -H windowsguibuild compiles (CI's exact Windows binary)--desktop=false: serves the API/dashboard in server modeNote for maintainers
No Wails binding regeneration and no API changes. This is a patch-level bug fix β feel free to merge with a
patch:prefix to cut a release. I deliberately used a non-patch:/minor:/major:subject so this fork PR doesn't trigger the signed release pipeline (which needs secrets unavailable to forks); only the test job runs.π€ Generated with Claude Code