fix: close window hides to tray instead of exiting & settings opens independently#5
Merged
Finesssee merged 2 commits intoFinesssee:mainfrom Mar 1, 2026
Merged
Conversation
Owner
|
Thanks for the PR! Hide-to-tray on close and independent settings window are solid UX improvements for a tray app. Merged. |
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.
Hi there!
First off, thanks for building CodexBar — it's a really nice tool and I've been enjoying using it on Windows. While using the tray app I ran into a couple of UX issues, so I took a stab at fixing them. Hope this is helpful.
What this PR fixes
1. Closing a window used to kill the entire app
As a tray application, I'd expect closing the window to just hide it — not exit. Now it hides to tray and keeps running, which feels much more natural.
2. "Settings" in tray menu was also showing the main window
Clicking "Settings" would pop up both the settings window and the main usage window. Now it only opens the settings window as expected.
What changed
All changes are in
rust/src/native_ui/app.rs(1 file, +33 −7):close_requestedevent → cancels the close → hides window withVisible(false). The app stays alive in the tray.show_main_window_no_focus()helper: Uses Win32ShowWindow(SW_SHOWNOACTIVATE)to wake the egui event loop without stealing focus from the settings window.Open/Refresh→restore_main_window()(brings main window to front)Settings→show_main_window_no_focus()+ moves main window off-screen, then opens only the preferences viewportKnown issue (not fixed here)
Worth flagging: Quit from the tray menu doesn't work when all windows are hidden. This is because
TrayMenuAction::Quit → std::process::exit(0)is handled inside the eguiupdate()loop — when windows are hidden, the loop pauses so tray events don't get processed. The user has to open a window first, then quit.A possible fix would be handling
Quitdirectly in the tray callback thread before sending to the egui channel, or callingstd::process::exit(0)in the tray event closure itself.Let me know if there's anything you'd like me to change. Thanks for reviewing!