fix(menubar): Capacity Dock hover works over any frontmost app - #1197
Merged
Conversation
…frontmost app The #1170 hover synthesis rides on a global .mouseMoved monitor, but macOS only delivers global mouse-moved events while the frontmost app itself requests them. Chrome does, so hover appeared fixed there; Finder and Terminal do not, so the dock went hover-dead over the desktop and most native apps. Add a 10 Hz pointer poll feeding the same passthrough + hover sync path. A same-position diff guard makes idle ticks free, and the timer lives and dies with the existing monitor lifecycle.
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.
Problem
After #1170, hovering the Capacity Dock icons only shows the detail bubble while Chrome (or another app that requests mouse-moved events) is frontmost. Over the Finder desktop or Terminal, hover is dead.
Root cause
#1170 synthesizes hover from
NSEvent.addGlobalMonitorForEvents(matching: .mouseMoved). macOS only delivers global mouse-moved events while the frontmost application itself requests them (acceptsMouseMovedEvents). Chrome requests them constantly for web hover; Finder and Terminal do not, so the monitor never fires. Tracking areas are no alternative here because the passthrough logic flipsignoresMouseEvents, which also suppresses tracking delivery.Fix
A 10 Hz pointer poll (
Timeron the main run loop,.commonmode) feeds the exact sameupdateMouseEventPassthrough+syncPointerHoverpath the monitors use. A same-position diff guard makes idle ticks free; the timer starts and stops with the existing monitor lifecycle, so a disabled dock costs nothing.Verification
swift test: 341 tests in 43 suites pass.