Repository navigation
fix(screenshot): let the visibility preference reach editor and pin windows - #1613
Conversation
…indows ScreenshotService.protectedWindowIDs unioned every window the app puts on screen before the "Hide Vorssaint windows" preference was consulted, so with the preference off the protected list re-excluded the editors and pins anyway and the switch could never reach them. The protected list now splits by role. Workflow surfaces — the selection overlays, the countdown and scrolling HUDs and the quick preview — are the tool taking the capture and stay out whatever the preference says. Editors and pinned captures are ordinary windows, so the preference owns them. Recording stays exempt from that preference, as ScreenshotSupport .unifiedCapturePolicy already has it, by asking for both kinds. Refs vorssaint#780
| let tool = options?.selectedTool | ||
| return ScreenshotService.shared.protectedWindowIDsForCapture( | ||
| honoursVisibilityPreference: tool != nil && tool != .recording) |
There was a problem hiding this comment.
with “hide vorssaint windows” off, keep the editor open and switch from recording to screenshot before selecting an area. with freeze on and the pointer off, the screenshot still uses the earlier picture without the editor or pins. switching the other way also leaves the editor selectable, and selecting it records it despite the intended recording exclusion. the text and color tools have the same stale-picture problem after recording. can switching tools refresh both the picture and the selectable windows whenever their visibility changes? add tests covering both directions
There was a problem hiding this comment.
switching tools now refreshes both whenever editor/pin visibility changes. UnifiedCapturePolicy gained keepsContentWindowsOut (true for recording, or when "hide vorssaint windows" is on) and sharesSource compares it, so with freeze on and the pointer off, recording <-> screenshot/text/color re-photographs the displays and rebuilds the pickable windows from the new tool's protected set. screenshot/text/color still share the picture they have.
56e3a47. tests in MetricsTests cover recording vs screenshot, text and color in both directions, no refresh between screenshot/text/color, and every tool keeping editors/pins out when the preference is on. added a mutation_checks entry that drops the new comparison and is caught. also merged main (notch capture chrome kept in the protected set). ./build.sh, --selftest, --test (38,166 checks) and Tests/mutation_checks.py (15/15) pass on macOS 26.
Keeps the notch capture chrome main added to the selection's protected windows alongside the per-tool editor and pin decision.
… switch changes own-window visibility With "Hide Vorssaint windows" off, recording keeps editors and pins out while screenshot, text and color let them in. The unified capture policy could not tell those apart: with freeze on and the pointer off every tool compared equal in sharesSource, so switching tools kept the earlier frozen picture and the earlier pickable-window list. A screenshot after recording missed the editor and pins, and after switching to recording the editor was still selectable. UnifiedCapturePolicy now carries keepsContentWindowsOut, and sharesSource compares it, so a switch in either direction re-photographs the displays and rebuilds the pickable windows with the new tool's protected set. Refs vorssaint#780
Block selection confirmations until the selected tool's pixels and window choices are ready. End the selection safely when any required display fails to refresh, and discard delayed loupe images from an older tool. Add production-method contracts for confirmation paths, missing displays, cancellation, out-of-order replies and subsequent preference changes, plus targeted mutation checks. Refs vorssaint#780
Let screenshot editors and pinned captures follow the screenshot visibility preference while preserving recording exclusions. Refresh pixels and selectable windows when switching tools. Reject stale confirmations while a refresh is pending, end safely on a missing display and discard delayed results from an older tool. Validated with automated contracts, targeted mutation checks, a local Developer build, installed selftest and signature verification. Refs vorssaint#780
Let screenshot editors and pinned captures follow the screenshot visibility preference while preserving recording exclusions. Refresh pixels and selectable windows when switching tools. Reject stale confirmations while a refresh is pending, end safely on a missing display and discard delayed results from an older tool. Validated with automated contracts, targeted mutation checks, a local Developer build, installed selftest and signature verification. Refs #780
Summary
With "Hide Vorssaint windows" switched off, the app's own screenshot editor
and pinned-capture windows still never appear in a capture. The Settings window
does, which matches the clarification on the issue.
ScreenshotService.protectedWindowIDsunioned every window the app puts onscreen — selection overlays, the countdown and scrolling HUDs, editors, pins and
the quick preview — and the capture paths then consulted the preference through
ScreenshotCapturePolicy.excludedWindowIDs, which excludes everything when thepreference is on and otherwise only the protected list. So with the preference
off, the protected list re-excluded the editors and pins anyway. The switch could
never reach them.
The protected list now splits by role:
tool's overlay, the countdown and scrolling HUDs, and the quick preview — are
the tool taking the capture, never its subject. They stay out whatever the
preference says.
somebody left on screen, so the preference owns them.
The quick preview is deliberately on the workflow side: it dismisses itself after
a few seconds, so on the content side back-to-back captures would photograph the
previous capture's toast.
Recording behaviour is unchanged.
ScreenshotSupport.unifiedCapturePolicyexempts recording from this preference on purpose (
tool != .recording), and thetoggle lives in the Screenshot settings pane, so routing it into the recorder
would be a direction change rather than a fix. Both recorder paths therefore ask
for both kinds. If you would rather the preference did reach recordings, that
is a one-word change at each call site and I will make it — flagging it because
it is the open question from the earlier attempt at this.
Callers checked before changing the shared property (all four reach it through
protectedWindowIDsForCaptureor the internalprotectedWindowIDs):ScreenshotServicesession / scrolling pathsScreenCaptureServiceselectionoptions.selectedToolScreenRecorderServicestream chromeScreenshotScrollingCaptureprotectedWindowIDsThe producers were each read on
main—ScreenshotEditorController,ScreenshotPinController,ScreenshotQuickPreviewControllerandScreenshotSelectionControllereach return only their own window, so neitherbucket picks up anything unexpected.
+99 / -11 across six files, tests included.
Verification
MacBook Pro (Mac16,7), Apple M4 Pro, 24 GB, macOS 26.6.2 build 25G83, Apple
Silicon. Single built-in display, default Spaces layout, app language English.
Two of my own builds run side by side for the comparison: upstream
mainas therelease variant, this branch as the
--devvariant, so the only differencebetween the two runs is the code. Signed with a stable Developer ID identity, so
the Screen Recording grant survived rebuilds.
The mutation entry is the both-directions check: reverting the split to the old
unconditional union fails the new assertion with
a screenshot protects only the surfaces taking it.By hand, "Hide Vorssaint windows" off:
mainthe editor is missing from the result — a hole where it was. On thisbranch the editor is in the shot, toolbar, tool palette and all.
⌘Pfrom the editor). Missingon
main, present on this branch."Hide Vorssaint windows" on, same two captures on this branch:
Also on this branch:
quick preview was still on screen does not contain that preview. This is the
case that decided which bucket the quick preview belongs in.
open screenshot editor does not contain that editor — the same as
main. Therecorder reaches the protected set through its own accessor and asks for both
kinds, so the exemption survives.
One display here, so the multi-display and multi-Space cases are the gap between
this Mac and yours. The change is per-window rather than per-screen, which is why
I would expect it to hold, but that is reasoning rather than a result.
Anything else
Refs #780
This is the change from #1269, which was closed because it had been written on a
Windows machine and never compiled or run. Rewritten and verified on a Mac, with
the quick preview moved to the workflow side and the recorder left alone — the
two points raised in that review.