feat(capture): choose what to capture — area, window, browser page or screen

Capture is now a decision, not a hidden setting. The popover shows a four-way scope control with the target named under it (800 x 600 on Display 1, the frontmost window, the front browser window, the whole display), and the window header carries the same choice beside the verbs. Picking Window or Browser hides Redline, dims the screen, names the app under the pointer and highlights its window; a click captures exactly that window, Escape cancels, and the desktop highlights the whole screen. New Session is one click: the current captures stay in their own folder, a fresh session opens, and the area picker comes straight up with the saved area pre-selected — Return keeps it, a drag replaces it. Settings is consolidated into one door (the popover gear, plus Cmd-,): what to capture, saved area, shortcut, ask-on-new-session, sending, session age limit, and a new Updates group with automatic install (on by default; installs only when nothing is unsent). The footer filler and the extra-actions menu are gone.
This commit is contained in:
Claude Fable 5
2026-11-01 11:47:58 +04:00
parent 1ae8351b04
commit 3fb9b504f4
18 changed files with 1601 additions and 152 deletions
+34 -2
View File
@@ -15,12 +15,40 @@ public final class RegionPickerController {
/// Presents one overlay per attached screen. A pick already in progress is cancelled
/// (its completion called with nil) before the new one starts — never leaves a caller
/// waiting forever on a dropped re-entrant call.
public func pick(completion: @escaping @MainActor (CaptureRegion?) -> Void) {
/// Passing `confirming` shows that area as already chosen and lets Return confirm
/// it — the fast path after "New Session": drag for a new area, or press Return to
/// keep the saved one.
public func pick(
confirming: CaptureRegion? = nil,
completion: @escaping @MainActor (CaptureRegion?) -> Void
) {
if self.completion != nil {
finish(region: nil)
}
self.confirmingRegion = confirming
self.completion = completion
presentOverlays()
if let confirming {
showConfirmingSelection(confirming)
}
}
private var confirmingRegion: CaptureRegion?
/// Shows the saved area as a pre-selection on the overlay for its display.
private func showConfirmingSelection(_ region: CaptureRegion) {
for window in windows where window.coveringScreen.frame.contains(
CGPoint(x: region.rect.midX, y: window.coveringScreen.frame.midY))
{
let local = CGRect(
x: region.rect.minX - window.coveringScreen.frame.minX,
y: region.rect.minY,
width: region.rect.width,
height: region.rect.height
)
window.updateSelection(
localRect: local, sizeText: "\(region.summary) · Return keeps it")
}
}
private func presentOverlays() {
@@ -72,7 +100,11 @@ public final class RegionPickerController {
switch type {
case .keyDown:
if keyCode == 53 { // kVK_Escape
finish(region: nil)
finish(region: confirmingRegion)
return true
}
if keyCode == 36, let confirmingRegion { // Return confirms the saved area
finish(region: confirmingRegion)
return true
}
return false