fix(tauri): never spawn a console window on Windows#33
Merged
Conversation
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
marked this pull request as ready for review
June 27, 2026 13:49
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
When testing on Windows, running
hyperdeck-adapterpops up a console window with text output. The app is tray-only — there should be no window.Root cause
src-tauri/src/main.rshad 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_assertionson, so the guard is inactive and a console appears:just build→cargo tauri build --debugjust run→cargo 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-accessibilityand--headlessCLI modes usable from a terminal (theyprintln!/eprintln!), the process now reattaches to the parent terminal's console viaAttachConsole(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
windowscrate dependency (Win32_System_Console); the same crate/version (0.58) is already in the tree viahyperdeck-os, so no new packages are pulled.Testing notes
src-tauri).cargo fmt --checkpasses insrc-tauri.src-taurirequires 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--headlessfrom a shell still prints.🤖 Generated with Claude Code
Generated by Claude Code