Keep the Windows main window in the tray when closed

DE
1d ago
+83-7

Summary

Intent: Closing the Windows main window currently quits the app, and the custom maximize control cannot restore it. Route Close, File > Close and Alt+F4 through close-to-tray, explicitly show the hidden main window on tray actions, and toggle native maximize/restore (ANLG-320).

The native adapter is Windows-only; other platforms retain their existing behavior.

Demo

Recorded native Windows regression tests verify visibility, process residency, retained notes and restored bounds on f9d3482cc2.

Main hidden; standalone remains editableCustom maximize restored to prior bounds
Hidden main and editable standaloneCustom restore

Verification

Windows Server 2022 / MSVC x64 / Rust 1.98.1, from apps/desktop-gpui, with the Windows portability patch from #8225 applied locally:

  • cargo fmt --check — passed.
  • cargo test --locked --workspace — passed: 496 tests, 3 existing ignored.
  • cargo clippy --locked --workspace --all-targets --no-deps -- -D warnings — passed.
  • cargo build --locked — passed.

Native regression tests passed on a verified-empty disposable profile without credentials: titlebar/Alt+F4/File/system-menu Close retained the same process and hidden main HWND; tray Open/Settings restored it and retained memo contents; standalone editing continued; maximize button and titlebar double-click restored exact prior bounds; maximized/fullscreen/minimized restoration and confirmed Quit Completely passed. Read-only HWND/process observations supplement the recording. GPUI's unit-test platform has no native HWND; Linux/macOS gates run in GPUI CI.

Open in Devin Desktop: https://app.devin.ai/desktop/session/ed4624d7fe134692a31c4e82b3bbad0a?variant=devin
Requested by: @ComputelessComputer


Summary by cubic

On Windows, closing the main window now hides it to the system tray instead of quitting the app. Alt+F4, File > Close, and the titlebar close button all route through close-to-tray, tray actions restore the hidden window, and the maximize control now toggles between maximized and restored instead of only maximizing. This is Windows-only; other platforms keep their existing behavior.