fix: launch Windows desktop app on double-click; drop the .bat launcher#3
Open
HuggeK wants to merge 1 commit into
Open
fix: launch Windows desktop app on double-click; drop the .bat launcher#3HuggeK wants to merge 1 commit into
HuggeK 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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