Skip to content

fix(tauri): never spawn a console window on Windows#33

Merged
statik merged 1 commit into
mainfrom
claude/hyperdeck-adapter-window-u6pllq
Jun 27, 2026
Merged

fix(tauri): never spawn a console window on Windows#33
statik merged 1 commit into
mainfrom
claude/hyperdeck-adapter-window-u6pllq

Conversation

@statik

@statik statik commented Jun 25, 2026

Copy link
Copy Markdown
Member

Problem

When testing on Windows, running hyperdeck-adapter pops up a console window with text output. The app is tray-only — there should be no window.

Root cause

src-tauri/src/main.rs had the GUI-subsystem attribute gated on the build profile:

#[cfg_attr(not(debug_assertions), windows_subsystem = "windows")]

That only suppresses the console in release builds. But the ways the app is actually tested on Windows compile with debug_assertions on, so the guard is inactive and a console appears:

  • just buildcargo tauri build --debug
  • just runcargo tauri dev

(There's no logger initialized, so the window is largely empty / shows only stray stderr — but it's still an unwanted window.)

Fix

Make the GUI subsystem unconditional so no build profile spawns a console:

#[windows_subsystem = "windows"]

To keep the --check-accessibility and --headless CLI modes usable from a terminal (they println!/eprintln!), the process now reattaches to the parent terminal's console via AttachConsole(ATTACH_PARENT_PROCESS) before those paths run. Launched from Explorer or a Start-menu shortcut there is no parent console, so it's a harmless no-op and still no window.

This adds a Windows-only windows crate dependency (Win32_System_Console); the same crate/version (0.58) is already in the tree via hyperdeck-os, so no new packages are pulled.

Testing notes

  • Library workspace is unaffected (change is confined to src-tauri).
  • cargo fmt --check passes in src-tauri.
  • src-tauri requires the desktop webview toolchain and is built by the dedicated Windows/macOS CI jobs — needs a real Windows build to confirm end-to-end that the tray launch shows no console while --headless from a shell still prints.

🤖 Generated with Claude Code


Generated by Claude Code

The tray app is a GUI-only application, but the `windows_subsystem =
"windows"` attribute was gated on `not(debug_assertions)`, so it only
took effect in release builds. Both `just build` (`cargo tauri build
--debug`) and `cargo tauri dev` compile with `debug_assertions` on, so a
console window popped up whenever the app was tested on Windows.

Make the GUI subsystem unconditional so no build profile spawns a
console. To keep the `--check-accessibility` and `--headless` CLI modes
usable, reattach to the parent terminal's console (AttachConsole /
ATTACH_PARENT_PROCESS) when one exists; launched from Explorer or a
shortcut there is no parent console and it is a harmless no-op.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GCLF5KBCnEL1QQs7ky5Kuy
@statik
statik marked this pull request as ready for review June 27, 2026 13:49
@statik
statik merged commit e937788 into main Jun 27, 2026
6 checks passed
@statik
statik deleted the claude/hyperdeck-adapter-window-u6pllq branch June 27, 2026 13:49
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.

2 participants