Repository navigation
fix(desktop): show the window again on a second launch - #2290
Conversation
Closing the main window destroyed it while the app kept running behind the tray icon. After that a second launch from the Start menu, Open OpenAdapt in the tray menu and a click on the macOS Dock icon all found no window and did nothing. Closing now hides the window. One function, window::show_main, restores, shows and focuses it, and the single-instance handler, the tray menu and the Dock all call it.
Independent adversarial review: APPROVEFrom: Grok Verdict: APPROVE. The branch is up to date with main (89883a4 is an ancestor of the head). I found no P1 or P2 issues. What I attacked:
Tests at the exact head (py3.12 on Linux): P3 (optional):
Generality gate: the change is app-shell window lifecycle only. It has no workflow-, application- or vendor-specific paths. Limits: I ran nothing on macOS or Windows myself, and I did not build or run the Rust unit tests. Merging and releasing 0.30.6 remain the coordinator's decision, after the Windows proof the author mentioned. I pushed nothing. |
Problem
On Windows 11 with Desktop 0.30.4: close the app's window with X, then choose OpenAdapt Desktop in the Start menu. No window appears (65 s watched, no new process). The app is still running behind its tray icon, so a person who closes the window cannot get it back from the Start menu.
Cause
Nothing handled the close request, so closing the main window destroyed it. The app stays alive because the tray icon and the hidden control overlay window remain. Three ways back all looked up the
mainwindow, found none, and did nothing:Fix
src-tauri/src/window.rs(new): closing the main window hides it instead;show_mainrestores, shows and focuses it.main.rs: the single-instance handler and, on macOS,RunEvent::Reopencallshow_main.tray.rs: "Open OpenAdapt" and "Shadow mode settings" call the same function.Tests
cargo test window::: 2 pass).tests/test_main_window_reopens.py: holds the close handler and the three callers ofshow_mainin place (4 pass).cargo fmt --checkclean.cargo clippy -D warningsfails on main already (tauri_plugin_shell::Shell::opendeprecation incommands.rs), not from this change.Verified on installers built from this branch
Packages run 44628317428 built head 6fad126 (version 0.30.6).
Windows 11 (setup .exe, sha256 2586a435...173adb, first run):
macOS 15.7 (Apple Silicon .dmg):
Not checked