Skip to content

fix: show dock icon while Settings is open so update dialogs can front - #2818

Merged
steipete merged 1 commit into
mainfrom
fix/settings-dock-activation
Aug 9, 2026
Merged

fix: show dock icon while Settings is open so update dialogs can front#2818
steipete merged 1 commit into
mainfrom
fix/settings-dock-activation

Conversation

@steipete

@steipete steipete commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Problem

CodexBar is packaged as an LSUIElement accessory app. Opening Settings did not change the activation policy, so Sparkle's Check for Updates and automatic new-version windows could appear behind other apps or fail to become key.

Root cause

The app remained on the accessory activation policy while presenting real windows. Calling activate alone is insufficient for reliable Dock presence and frontmost window behavior, and reverting too early can pull an update dialog away when Settings closes first.

Behavior

  • Promote CodexBar to the regular activation policy and activate it before opening Settings or invoking Sparkle.
  • Recognize the actual PreferencesView hosting window as well as SwiftUI's settings identifier.
  • Promote for automatically presented titled Sparkle windows.
  • Stay regular while any real visible keyable window remains.
  • Ignore the lifecycle keepalive window, status-bar windows, tiny keepalive windows, and utility windows that cannot become key.
  • Re-evaluate after close on the next main-actor turn, then return to accessory mode only after the last real window closes.

Test evidence

  • swift test --filter '(DockIconPolicyDecisionTests|SettingsWindowOpeningTests)' — 6 tests passed.
  • make check — formatting, SwiftLint, manifests, package checks, docs, and repository gates passed.
  • CODEXBAR_TEST_SUITE_TIMEOUT=600 make test through the structured review helper — all 833 selections in 70 groups passed; no retries or timeouts.
  • Structured autoreview — clean, no accepted/actionable findings.

Live source-blind UI validation was not run because app startup can exercise real Keychain migration/read paths, which repository safety rules prohibit without an explicit live-test request.

@clawsweeper

clawsweeper Bot commented Aug 9, 2026

Copy link
Copy Markdown

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@clawsweeper

clawsweeper Bot commented Aug 9, 2026

Copy link
Copy Markdown

ClawSweeper status: review started.

I am starting a fresh review of this pull request: fix: show dock icon while Settings is open so update dialogs can front This is item 1/1 in the current shard. Shard 0/1.

This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking.

Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bf0a26e5ee

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

self.ensureRegularPolicy(activate: hasNewPresentedWindow)
}

guard self.isManagingRegularPolicy, !self.isAwaitingPresentedWindow else { return }

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Clear pending promotion when no window appears

If promote() is called but no Settings/Sparkle window is ultimately presented — for example the settings opener falls through both paths or Sparkle suppresses/fails the check before creating UI — isAwaitingPresentedWindow stays true forever. This guard then blocks every later reevaluation from returning the LSUIElement app to .accessory after all real windows are gone, so CodexBar can remain in the Dock until relaunch; reset the pending state on failed presentation or add a bounded timeout/no-window demotion path.

Useful? React with 👍 / 👎.

@steipete
steipete merged commit b20dc23 into main Aug 9, 2026
8 checks passed
@steipete

steipete commented Aug 9, 2026

Copy link
Copy Markdown
Owner Author

Live-tested on macOS 26 with the signed release-packaged bundle from this branch:

  • At rest: lsappinfo reports ApplicationType=UIElement (no dock icon).
  • Opening Settings promotes to Foreground — dock icon appears, window fronts.
  • "Check for Updates" in About now visibly presents the Sparkle dialog ("You're up to date! CodexBar 0.49.0…"), which was the reported bug.
  • Dismissing the dialog and closing Settings demotes back to UIElement; only the lifecycle keepalive window remains.

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.

1 participant