Skip to content

fix: use GUI subsystem for all Windows builds (no console on startup)#3

Merged
PalmarHealer merged 2 commits into
mainfrom
fix/windows-console-subsystem
Jun 2, 2026
Merged

fix: use GUI subsystem for all Windows builds (no console on startup)#3
PalmarHealer merged 2 commits into
mainfrom
fix/windows-console-subsystem

Conversation

@PalmarHealer

Copy link
Copy Markdown
Contributor

Problem

On Windows the app boots on startup but opens a terminal window; closing that terminal quits the app.

Cause

src/main.rs only applied the GUI subsystem in release builds:

#![cfg_attr(all(target_os = windows, not(debug_assertions)), windows_subsystem = windows)]

Debug builds therefore default to the console subsystem. When Windows launches a console exe (autostart HKCU\...\Run, a shortcut, or Explorer), it creates a terminal that owns the process, so closing the terminal kills the app.

Fix

  • Apply windows_subsystem = windows unconditionally on Windows, so no build ever spawns a console window.
  • Re-attach to the parent console in debug via AttachConsole(ATTACH_PARENT_PROCESS) so cargo run from a terminal still shows logs (no-op when launched from Explorer/autostart).
  • Add the Win32_System_Console feature for AttachConsole.

Follow-up for users

After rebuilding, toggle autostart off→on (or re-run the installer) so the Run key re-registers the rebuilt GUI binary; a stale entry pointing at an old console exe will keep opening a terminal.

🤖 Generated with Claude Code

PalmarHealer and others added 2 commits June 2, 2026 13:08
Debug builds defaulted to the console subsystem, so launching the exe
(autostart, shortcut, Explorer) opened a terminal that owned the process
- closing it killed the app. Apply windows_subsystem = windows
unconditionally on Windows, and re-attach to the parent console in debug
so `cargo run` from a terminal still shows logs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@PalmarHealer PalmarHealer merged commit 8d1af02 into main Jun 2, 2026
@PalmarHealer PalmarHealer deleted the fix/windows-console-subsystem branch June 2, 2026 11:16
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