fix(macos): keep the Settings window in front when hiding the Dock icon - #112
Merged
Merged
Conversation
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.
Why
Turning off Show Dock icon while Settings is open makes the window disappear (#103). Switching HEX to a menu-bar-only (accessory) app makes macOS deactivate it asynchronously, so the window drops behind other applications. In an isolated GPUI probe the deactivation arrived twice, about 10 ms and again about 200 ms after the policy change, so re-activating immediately (or once) still lost the window.
What Changes
The Dock icon is shown whenever a Settings window is open, and the preference applies to the closed state.
Before
After
flowchart LR A["Settings window opens"] --> B["Regular: Dock icon visible"] B --> C{"Window closes"} C -->|"Show Dock icon on, or no menu-bar item"| B2["Regular"] C -->|"Show Dock icon off and menu-bar item installed"| D["Accessory: menu bar only"]The toggle no longer changes the activation policy itself. Startup keeps its existing behavior, including the fallback that keeps the Dock icon when the menu-bar item could not be installed. The row subtitle now reads "When off, HEX stays in the menu bar while Settings is closed".
Scope
Fixes #103. It also fixes the Rust 1.99 build, which became CI's stable toolchain on September 28 and broke every branch:
bail!in expression position now fails-D warnings(semicolon_in_expressions_from_non_local_macros), andAtomicU8::fetch_updateis deprecated. Those call sites now returnErr(eyre!(..))and use an explicit compare-exchange loop. Hiding (Cmd-H) or minimizing Settings keeps the Dock icon, since the window is still open.Verification
voice-control app) with the menu-bar item installed and Show Dock icon off: quiet startup wasUIElement; opening Settings switched toForeground; toggling on and off saved the preference while stayingForegroundwith the window on screen; closing the window returned toUIElement. Checked withlsappinfoand window listings. Not yet exercised in a signed, installed build.