fix: mitigate macOS 26 Tahoe menu bar state corruption hiding the tray icon#571
Open
robinebers wants to merge 1 commit into
Open
fix: mitigate macOS 26 Tahoe menu bar state corruption hiding the tray icon#571robinebers wants to merge 1 commit into
robinebers wants to merge 1 commit into
Conversation
…y icon macOS 26 hosts third-party status items through ControlCenter, and its per-app bookkeeping can corrupt (notably on 26.5), parking the tray icon off-screen and leaving the app unreachable. Mirrors fixes shipped by other affected menu bar apps (CodexBar, oMLX): 1. Clear stale `NSStatusItem Visible* = false` defaults before the tray is created, and migrate the saved menu bar position to the new identity so existing installs keep their slot. 2. Give the status item an explicit autosave name so affected installs re-register under a fresh ControlCenter identity. 3. Probe the status item after startup (macOS 26+, two probes 10s apart) and show recovery guidance if it never lands in the menu bar. Mitigates #517 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
📝 WalkthroughWalkthroughThis PR implements macOS 26 (Tahoe) menu bar tray icon recovery mitigations. It expands AppKit dependencies, adds a new macOS-conditional module with pre-build default cleanup, post-build identity adoption, and a health check with recovery guidance, then integrates these steps into tray initialization. ChangesmacOS 26 Tahoe tray icon mitigations
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
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.
Summary
Closes #517 — on macOS 26.5 (Tahoe), ControlCenter's menu bar bookkeeping can corrupt per-app, parking the status item off-screen at
(-1, screenHeight-1)and leaving the app completely unreachable. This is an OS bug (same signature hit CodexBar, Stats, oMLX, NetBird, BetterDisplay), so this PR ships the same mitigations those projects merged:6665d028): dropsNSStatusItem Visible* = falserecords left behind by Tahoe's menu bar migration;true/unrelated entries are untouched. Also migrates the savedPreferred Positionfrom the auto-generatedItem-0identity to the new one, so existing installs keep their menu bar slot.autosaveNameon the status item (oMLX7f38bf6): tray-icon leaves the auto-generatedItem-0identity — exactly the record Tahoe corrupts. A custom name re-registers affected installs under a fresh ControlCenter identity on update.Implementation: reaches the raw
NSStatusItemviaTrayIcon::with_inner_tray_icon→ns_status_item(); the neededobjc2-app-kit/objc2-foundationfeatures unify with the versions tray-icon already pulls.Testing
cargo test— 131 passing (4 new unit tests covering the broken-state detection: off-screen, hidden, allow-list-blocked signatures)cargo clippy— clean on changed filesvisible: true, has_button: true, has_window: true, has_screen: true, window_y: 1084.0(the bug signature ishas_screen: false, window_y: -22), no alert fires, and the position migration verifiably copiedPreferred Position Item-0→Preferred Position OpenUsagein the live defaults domainNotes
docs/describe tray placement behavior, so none needed updating.StatusItemHealthmakes any report easy to triage.🤖 Generated with Claude Code
Note
Medium Risk
macOS-only startup logic touches NSUserDefaults and raw NSStatusItem via tray internals; incorrect probes could false-positive alerts, but scope is gated to macOS 26+ with double-delay confirmation.
Overview
Adds macOS 26 (Tahoe)–specific tray mitigations for ControlCenter menu bar state corruption (#517), where the status item can stay hidden or off-screen while the app still thinks it is fine.
A new
tray_tahoemodule runs before tray creation to clear staleNSStatusItem Visible* = falsedefaults and migrate Preferred Position from legacyItem-0to a stableOpenUsageautosave identity. After the tray is built, it sets that autosave name on the rawNSStatusItemand, on macOS 26+, runs a double health probe (5s + 10s) that shows anNSAlertwith System Settings recovery steps if the icon is not actually hosted in the menu bar.tray::createwires these hooks and keeps the built tray handle for post-build setup.Cargo.tomlexpandsobjc2-foundation/objc2-app-kitfeatures forNSUserDefaults, status item APIs, and alerts.Reviewed by Cursor Bugbot for commit 4005e1c. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by cubic
Mitigates a macOS 26 (Tahoe) menu bar bug that can hide the tray icon by corrupting ControlCenter state, restoring visibility and adding recovery guidance. Addresses #517.
Bug Fixes
NSStatusItem Visible* = falsedefaults and migratePreferred PositionfromItem-0toOpenUsagebefore tray creation.autosaveNamefor the status item to replace the corruptedItem-0identity.Dependencies
objc2-foundationfeatures (NSUserDefaults,NSValue) andobjc2-app-kitfeatures (NSStatusItem,NSStatusBarButton,NSWindow,NSAlert, others) needed for defaults cleanup, identity adoption, and the alert.Written for commit 4005e1c. Summary will update on new commits.
Summary by CodeRabbit
Bug Fixes
Improvements