Skip to content

fix: launch Windows desktop app on double-click; drop the .bat launcher#3

Open
HuggeK wants to merge 1 commit into
srcfl:mainfrom
HuggeK:fix/windows-desktop-launch
Open

fix: launch Windows desktop app on double-click; drop the .bat launcher#3
HuggeK wants to merge 1 commit into
srcfl:mainfrom
HuggeK:fix/windows-desktop-launch

Conversation

@HuggeK

@HuggeK HuggeK commented Jun 25, 2026

Copy link
Copy Markdown

Problem

On Windows, double-clicking device-simulator.exe from the release zip appears to do nothing β€” no window opens.

Root cause: the released .exe is built with -H windowsgui (GUI subsystem, no console), and the --desktop flag defaulted to false. A double-click therefore started a hidden, headless HTTP server with no window and no console output. The Wails desktop window only appeared when --desktop was passed β€” which is why the release shipped a Device-Simulator.bat whose only job was to add that flag. That .bat workaround is fragile: antivirus false-positives, a console flash, and it's easy to misplace.

Fix

Gate the --desktop default on the desktop build tag, via two small files:

  • cmd/simulator/desktop_mode_on.go (//go:build desktop) β†’ defaultDesktopMode = true
  • cmd/simulator/desktop_mode_off.go (//go:build !desktop) β†’ defaultDesktopMode = false

The 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 .bat needed. The Docker image and the *-server Makefile targets omit the tag and keep defaulting to the headless HTTP server. WAILS_DESKTOP now also accepts 0 to force headless (mirroring 1).

Removed the generated Device-Simulator.bat step from the Windows CI build.

Headless mode (now documented)

The same executable still runs headless:

device-simulator.exe --desktop=false

then browse to http://localhost:8762. Documented in the README, the release notes, and CLAUDE.md. (Because the released .exe is 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-server for console logs.)

Changes

  • cmd/simulator/main.go β€” flag default is now defaultDesktopMode; WAILS_DESKTOP handles both 0 and 1
  • cmd/simulator/desktop_mode_on.go, desktop_mode_off.go β€” build-tag-gated default (new)
  • .github/workflows/build.yml β€” drop .bat generation; update Windows install + headless notes
  • README.md, CLAUDE.md β€” document double-click launch and --desktop=false headless mode

Verification

  • go test ./... passes
  • Default (untagged) build compiles and runs in server mode
  • -tags "desktop,production" -H windowsgui build compiles (CI's exact Windows binary)
  • Smoke-tested --desktop=false: serves the API/dashboard in server mode

Note 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

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant