Skip to content

fix: recover the status item when the menu bar parks it under the notch - #994

Closed
maxmilian wants to merge 2 commits into
robinebers:mainfrom
maxmilian:fix/notch-occlusion-fallback
Closed

maxmilian wants to merge 2 commits into
robinebers:mainfrom
maxmilian:fix/notch-occlusion-fallback

Conversation

@maxmilian

Copy link
Copy Markdown

TL;DR

When a crowded menu bar pushes the status item under the MacBook notch, OpenUsage becomes invisible and unclickable while its log reports "Status item ready". This PR detects that state and recovers: it moves the item back into the visible menu bar, falls back to a small surrogate button if the move doesn't stick, and anchors the panel beside the notch instead of under it.

Closes #993 (opened first per the issue-first flow; measurements and dead-end analysis live there).

What was happening

  • macOS lays status items right-to-left; when the right-of-notch area fills up, the leftmost third-party item overflows under the notch (measured: text strip at x 767–937, bars glyph at x 902–938, notch 791–1012 — zero to 24 pt visible).
  • The app keeps running and logs Status item ready (button: true, …), so to the user OpenUsage "never launched", and relaunching lands it in the same spot.
  • Shrinking the item cannot help: its right edge is pinned by its neighbors, so narrower styles are more hidden. There is no public API to reposition an NSStatusItem.
  • Opening the panel (e.g. via the global shortcut) anchored it below the hidden button — a window materializing centered under the notch.

What this changes

  • NotchGeometry (new, pure) — computes the notch rect from auxiliaryTop*Area, how much of the button it hides (occluded at ≥75%), and the fallback panel anchor. Mirrors the PanelGeometry pattern; unit-tested with the real measured fixtures.
  • Self-rescue (primary) — StatusItemController.repositionStatusItemRightOfNotch() rewrites the item's remembered position (the same NSStatusItem Preferred Position default that ⌘-dragging maintains) and bounces autosaveName so AppKit re-reads it; the item re-lands just right of the notch. Verified live on macOS 26.5.2: a 99%-hidden item moved to the visible menu bar.
  • StatusItemOcclusionMonitor (new) — checks after launch, on screen-parameter changes, and on a slow 30 s poll. One rescue per occlusion episode; it re-measures afterwards and only if the item is still hidden shows a surrogate button (borderless non-activating panel, icon-only) just below the menu bar at the nearest visible notch edge — click opens the dashboard, drag to move, right-click → Hide Until Relaunch. Hidden while the dashboard is open, and removed automatically the moment the real item is visible again.
  • Panel anchoring — showPanel() anchors at the nearest visible notch edge whenever the button is effectively hidden, so the panel never opens centered under the notch.
  • Docs — docs/menu-bar.md gains a short "The notch" section.

Heads-up

  • The rescue leans on the undocumented-but-long-stable preferred-position defaults key (it is how every item's position persists). If a future macOS stops honoring it, the post-rescue re-measure catches that and the surrogate button takes over — behavior degrades to "still reachable", never back to "invisible".
  • The rescue is zero-sum: re-landing right of the notch nudges a neighbor leftward. Deliberate — the user is trying to reach OpenUsage.
  • Non-notched Macs: auxiliaryTop*Area is nil, every new path is inert, zero behavior change.
  • An earlier IUO footgun is documented in-code: interpolating statusItem.autosaveName directly writes a key literally named … Optional("Item-0") that AppKit never reads.

Tests

  • NotchGeometryTests (8 cases) — fixtures are the real AX measurements from the reproducing machine (screen 1800×1169, notch 791–1012, item frames 767×170 / 902×36).
  • Full suite: the only failures are the 4 Codex tests that already fail on a clean main checkout.
  • Live verification on macOS 26.5.2 (notched 14"): rescue moves the item into view (screenshot below); with the rescue defeated, the surrogate button appears and opens the panel anchored at the notch edge (anchoring the panel at x=1012 in the log).

Screenshots

Status item rescued back into the visible menu bar (Claude/Codex/Z.ai strip, right of the notch):

rescued

Surrogate button (fallback path) below the menu bar at the notch's right edge:

pill

🤖 Generated with Claude Code

https://claude.ai/code/session_019dpF8491eHK8reiuJ8vMxB

@robinebers robinebers added the needs-approved-issue External PR needs an open issue with status:approved label Jul 13, 2026 — with Cursor

@cursor cursor 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.

Thanks for the PR! OpenUsage reviews external PRs only when they implement an issue a maintainer has already approved with the approved label. Please open an issue, wait for approval, then reopen this (or open a focused PR) linking it with Fixes #<issue>. Happy to take a look once it's linked to an approved issue.

Powered by Cursor Automations

Open in Web View Automation 

Sent by Cursor Automation: OpenUsage PR Gatekeeper

On a notched MacBook with a crowded menu bar, macOS pushes the leftmost
third-party status item underneath the notch: the app logs "Status item
ready" but nothing is visible or clickable anywhere. Detect that state
(pure geometry over auxiliaryTop*Area, >=75% hidden) and recover in
layers: rewrite the item's preferred position and bounce autosaveName so
it re-lands right of the notch; if that doesn't stick, show a small
surrogate button below the menu bar that opens the dashboard; and anchor
the panel at the nearest visible notch edge whenever it opens while the
item is hidden.

Fixes robinebers#993

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_019dpF8491eHK8reiuJ8vMxB
macOS 27 manages menu-bar overflow natively (overflowing items fold
behind a chevron instead of being parked under the notch), so the
rescue/pill fallback would be dead code there. Gate both entry points
on NotchGeometry.fallbackIsNeeded so the whole feature is a no-op on
27+ and can be deleted wholesale once macOS 26 support ends.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Ur7TeBoBSYXwFexxaJJExC
@github-actions

Copy link
Copy Markdown

This PR has been inactive for 7 days. It will be closed in 3 days unless there is new activity. If this is still relevant, please comment or push an update.

@github-actions github-actions Bot added the stale No recent activity label Jul 27, 2026
@maxmilian

Copy link
Copy Markdown
Author

Still relevant — flagging that rather than letting the timer run out.

The state here is a label, not a technical blocker. @robinebers reviewed the approach on #993 on Jul 18 ("Gating it to 26 and below would be acceptable if the UX gets this right yes. Will keep this open and take a look."), and I pushed that version gate on Jul 20 (a17ea1a): NotchGeometry.fallbackIsNeeded(onMacOSMajorVersion:) returns false for 27+, so the whole fallback — occlusion monitor, pill, panel anchoring — is inert on Golden Gate and can be deleted in one sweep whenever macOS 26 support is dropped. swift build is clean and NotchGeometryTests is green; the branch is rebased and MERGEABLE.

It's still a draft only because of the issue-first gate: #993 hasn't been marked approved yet. Happy to flip it to ready the moment that lands — and equally happy to close it if the Golden Gate timing makes it not worth carrying. Just don't want the bot to make that call by default.

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

This PR has been inactive for 7 days. It will be closed in 3 days unless there is new activity. If this is still relevant, please comment or push an update.

@github-actions github-actions Bot added the stale No recent activity label Aug 5, 2026
@maxmilian

Copy link
Copy Markdown
Author

Still relevant — but this is the second time I'm answering the bot on this PR, so rather than just saying that again, here is where it actually stands and a concrete way to end the loop.

The fix is still the only one for this bug. Re-checked against main today:

Everything you asked for is in. On Jul 18 you said "Gating it to 26 and below would be acceptable if the UX gets this right yes. Will keep this open and take a look." — a17ea1a (Jul 19) does exactly that: NotchGeometry.fallbackIsNeeded gates on majorVersion <= 26, so on 27+ the monitor never starts and the panel-anchor branch is skipped. It has been sitting on that commit since.

What's actually blocking is a label, not code. The PR carries needs-approved-issue, and stale.yml exempts only pinned,security,keep-open,approved,gate-passed — none of which #993 or this PR has. So the 7-day timer keeps restarting and I keep answering it, which is noise for both of us.

@robinebers, whichever of these you prefer is fine by me:

  1. You want it → marking Status item parked under the MacBook notch: app becomes invisible and unreachable (logs say "Status item ready") #993 approved (or this PR keep-open) stops the timer and I'll take it out of draft. It's BEHIND main right now; say the word and I'll rebase — I've held off rather than pushing commits just to keep a bot quiet.
  2. You want changes first → tell me what the UX still gets wrong and I'll push; the 495 lines here include 8 measured fixtures in NotchGeometryTests.swift, so it's cheap for me to adjust.
  3. You don't want it → say so and I'll close it myself today. A wontfix from you is a perfectly good outcome; I'd just rather it be your call than an inactivity timer's.

No rush on my end, and no need to reply to this if option 1 is just a label click.

@github-actions github-actions Bot removed the stale No recent activity label Aug 6, 2026
@maxmilian

Copy link
Copy Markdown
Author

Closing this myself.

No answer came back on the three options above, and I'd rather take it off your queue than keep resetting a 7-day timer on a PR you haven't had a chance to weigh in on. To be clear about what this is and isn't: you never said you didn't want it — I'm not reading silence as a decision, I'm just not leaving it for the bot to make.

The work isn't lost. The branch stays up, a17ea1a still has the version gate you asked for on Jul 18 (fallbackIsNeeded returns false for macOS 27+, so the whole fallback path is inert on Golden Gate), and NotchGeometryTests still has the 8 measured fixtures. If #993 ever gets approved, say the word and I'll reopen and rebase — that's a couple of minutes of work, not a restart.

Thanks for the Jul 18 steer on gating; it was the right call and it made the diff considerably smaller than what I first proposed.

@maxmilian maxmilian closed this Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs needs-approved-issue External PR needs an open issue with status:approved tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Status item parked under the MacBook notch: app becomes invisible and unreachable (logs say "Status item ready")

2 participants