Skip to content

feat: hover-to-select windows in the All-in-One overlay - #409

Merged
lzhgus merged 1 commit into
lzhgus:mainfrom
jiagenli:feat/all-in-one-window-snap
Nov 21, 2026
Merged

lzhgus merged 1 commit into
lzhgus:mainfrom
jiagenli:feat/all-in-one-window-snap

Conversation

@jiagenli

Copy link
Copy Markdown
Contributor

What changed

All-in-One required a detour through the separate Window mode: the HUD's Window button dismissed the frozen overlay, re-enumerated windows and re-froze the screen before a window could be picked.

The first overlay now does the hit testing itself:

  • Hover: area mode resolves the window under the pointer and draws the same rounded highlight + title label as Window mode (reuses highlightWindow / screenRectToViewRect).
  • Click to snap: a press that moves ≤ 3 pt snaps the selection to that window's frame (clipped to the display) and calls the existing onAreaSelected path, so presets, annotation, OCR, copy, save and pin keep working unchanged.
  • Drag still wins: movement past the threshold cancels the snap and keeps freeform selection.
  • Coordinator: attachWindowSnapCandidates enumerates SCShareableContent after the overlays are on screen, so the freeze and the first frame stay instant, then pushes the candidates to every display overlay. Capso's own capture chrome (freeze backdrops, capture overlays, Quick Access cards) is filtered out by window number — otherwise every hover would hit our own full-screen freeze window.

No new user-facing strings, no project.yml change, no new files.

Related issue

N/A — small feature. Happy to gate it behind a setting or to open an issue first if you'd prefer that flow.

Screenshots / recordings

No media: this is pointer behavior (hover highlight + click), nothing to show in a static shot. Verified with a local Debug build and manual testing: hover highlight, click-snap into the HUD, drag still freeform, second display.

On tests: WindowInfo can only be constructed from an SCWindow, so the snap path has no seam for a unit test today. I can add a memberwise initializer plus overlay interaction tests in a follow-up if you want that covered.

Checklist

  • xcodegen generate not needed (no source layout change)
  • Debug build passes (xcodebuild -project Capso.xcodeproj -scheme Capso -configuration Debug build)
  • No new TODO / FIXME / debug prints
  • Swift 6 strict concurrency respected (no new Sendable boundaries; the enumeration stays on @MainActor)
  • Contribution licensed under the repo license

All-in-One needed a detour through the separate Window mode: the Window
button dismissed the frozen overlay, re-enumerated windows and re-froze
the screen before a window could be picked.

The first overlay now hit-tests windows itself:

- area mode resolves the window under the pointer and draws the same
  rounded highlight and title label as Window mode;
- a click without meaningful movement snaps the selection to that window
  and reuses the existing onAreaSelected path, so presets, annotation,
  OCR, copy, save and pin keep working unchanged;
- a drag past 3 pt keeps freeform selection.

CaptureCoordinator feeds the candidates once the overlay is on screen so
the freeze and first frame stay instant, and filters out Capso's own
capture chrome (freeze backdrops, overlays, Quick Access) by window
number so hover never hits our full-screen freeze window.

@lzhgus lzhgus left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks for this — tested locally in a Debug build: hover highlight, click-to-snap, drag-still-freeform, and clipping at the display edge all behave as described. Merging once CI is green.

@lzhgus
lzhgus merged commit 4bdf0bf into lzhgus:main Nov 21, 2026
2 checks passed
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.

2 participants