Repository navigation
Conversation
A .transient NSPopover only dismisses on outside clicks the app itself receives. Opening another menu bar popup (a system menu or another app's status item) deactivates PokeTokenBar without delivering that outside click, so the popover stayed open. Close it on didResignActive. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
@jjamming Thanks for tracking this down — the popover really does linger when a menu bar popup opens, and pinpointing Before merging I A/B tested it here (macOS 26.5, scratch app reproducing
Two signals that do fire, both verified in a signed
With either, register when the popover opens and remove it in If you did see it close at runtime on your machine, let me know your macOS version — that would mean my repro diverges from the real app and I'd re-check before we settle on a mechanism. |
Opening another menu bar popup does not deactivate the app, so didResignActiveNotification never fires and the popover lingered. Register an NSEvent global mouse monitor while the popover is open and remove it in popoverDidClose (zero idle cost); keep the isShown guard. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
@chattymin Thanks for the review. My last commit went out with only the code change and no local testing — and when I actually ran it, it failed exactly the way you described. I've reworked it along the lines you suggested and confirmed it works locally (video attached). Thanks again for taking a second look. |
df92dc3 to
b447c8c
Compare
|
Thank you for your contribution! |
Update — reworked after review
Review testing was correct: opening another menu bar popup does not post
didResignActiveNotification(the app stays active), so the original observer never ran — the patch was a no-op for this exact case. Switched to the suggested global monitor:NSEvent.addGlobalMonitorForEvents([.leftMouseDown, .rightMouseDown])when the popover opens, remove it inpopoverDidClose(zero idle cost), keep the returned token, and keep theisShownguard.didResignActiveobserver entirely.Verified in a signed
.appon macOS 26 with real clicks: opening Control Center / Wi-Fi now dismisses the popover; desktop / other-app clicks and in-popover buttons still behave; no input-monitoring permission prompt appears.Video
poketoken_tobe.mp4
Checklist
swift buildpasses locally; verified live in a signed.app(manual click test); full suite runs in CINSEventglobal monitor is AppKit runtime behavior not exercisable without a running app; verified by manual click test insteadOriginal description (superseded by the rework above)