Skip to content

fix(macos): keep the Settings window in front when hiding the Dock icon - #112

Merged
kitlangton merged 2 commits into
mainfrom
fix/dock-icon-settings-window
Oct 2, 2026
Merged

kitlangton merged 2 commits into
mainfrom
fix/dock-icon-settings-window

Conversation

@kitlangton

@kitlangton kitlangton commented Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

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

  1. Settings open, toggle Show Dock icon off.
  2. HEX becomes menu-bar only immediately and the window falls behind the previous app.

After

  1. Settings open, toggle Show Dock icon off. The preference saves; the icon and window stay.
  2. Close Settings. HEX becomes menu-bar only.
  3. Open Settings from the menu bar. The icon appears while the window is open.
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"]
Loading

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), and AtomicU8::fetch_update is deprecated. Those call sites now return Err(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

cargo fmt --check
cargo +1.99.0 clippy --all-targets --all-features -- -D warnings
cargo +1.99.0 clippy --all-targets -- -D warnings
cargo +1.99.0 test
cargo clippy --all-targets --all-features -- -D warnings
cargo test
git diff --check
  • 490 tests passed, 12 ignored, on Rust 1.95 and 1.99. Two OpenCode service-discovery tests with 2 to 3 second subprocess deadlines failed once under a cold full-suite build on 1.99 and passed on rerun and in isolation; they are unchanged here. Linux-only modules are checked only by CI.
  • Isolated GPUI probe (macOS 27): switching an active window's app to accessory deactivated it within 10 ms, and immediate or once-deferred re-activation was undone again by about 200 ms. Reopening a window after switching back to regular left it key and frontmost.
  • Real debug build (voice-control app) with the menu-bar item installed and Show Dock icon off: quiet startup was UIElement; opening Settings switched to Foreground; toggling on and off saved the preference while staying Foreground with the window on screen; closing the window returned to UIElement. Checked with lsappinfo and window listings. Not yet exercised in a signed, installed build.

@kitlangton
kitlangton merged commit 935c713 into main Oct 2, 2026
2 checks passed
@kitlangton
kitlangton deleted the fix/dock-icon-settings-window branch October 2, 2026 16:52
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.

Settings windows closes itself when toggling off "Show dock icon"

1 participant