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:
@@ -0,0 +1,79 @@
|
||||
import Foundation
|
||||
|
||||
/// What a capture takes a picture of.
|
||||
///
|
||||
/// The choice belongs to the session being captured into: it is stored once and copied
|
||||
/// to the next session, so a review run keeps capturing the same kind of thing until
|
||||
/// the user says otherwise. Choosing anything other than `.area` never clears the saved
|
||||
/// area — it comes back when Area is chosen again.
|
||||
public enum CaptureScope: String, Codable, Sendable, CaseIterable {
|
||||
case area
|
||||
case window
|
||||
case browser
|
||||
case screen
|
||||
|
||||
/// Label for the segmented control and the window's menu.
|
||||
public var displayName: String {
|
||||
switch self {
|
||||
case .area: return "Area"
|
||||
case .window: return "Window"
|
||||
case .browser: return "Browser"
|
||||
case .screen: return "Screen"
|
||||
}
|
||||
}
|
||||
|
||||
/// The longer menu item wording (window picker).
|
||||
public var menuTitle: String {
|
||||
switch self {
|
||||
case .area: return "Saved Area"
|
||||
case .window: return "Front Window"
|
||||
case .browser: return "Browser Page"
|
||||
case .screen: return "Whole Screen"
|
||||
}
|
||||
}
|
||||
|
||||
/// Sentence shown under the control: what pressing Capture will take.
|
||||
public func targetDescription(savedArea: CaptureRegion?) -> String {
|
||||
switch self {
|
||||
case .area:
|
||||
guard let savedArea else { return "No area saved yet — choose one first" }
|
||||
return savedArea.summary
|
||||
case .window:
|
||||
return "The frontmost window when you capture"
|
||||
case .browser:
|
||||
return "The frontmost browser window when you capture"
|
||||
case .screen:
|
||||
guard let savedArea else { return "The display with the frontmost window" }
|
||||
return "All of Display \(savedArea.displayNumber)"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Persistence for the capture choice. Stored separately from the chosen area so
|
||||
/// switching scope never destroys the area.
|
||||
public enum CaptureSettings {
|
||||
public static let scopeKey = "ai.flowmaster.shotdeck.captureScope"
|
||||
public static let askOnNewSessionKey = "ai.flowmaster.shotdeck.askScopeOnNewSession"
|
||||
|
||||
public static func scope(defaults: UserDefaults = .standard) -> CaptureScope {
|
||||
guard let raw = defaults.string(forKey: scopeKey),
|
||||
let scope = CaptureScope(rawValue: raw)
|
||||
else { return .area }
|
||||
return scope
|
||||
}
|
||||
|
||||
public static func setScope(_ scope: CaptureScope, defaults: UserDefaults = .standard) {
|
||||
defaults.set(scope.rawValue, forKey: scopeKey)
|
||||
}
|
||||
|
||||
/// Whether "New Session…" asks what to capture before starting. Off means it
|
||||
/// starts immediately with the current choice.
|
||||
public static func askOnNewSession(defaults: UserDefaults = .standard) -> Bool {
|
||||
guard defaults.object(forKey: askOnNewSessionKey) != nil else { return true }
|
||||
return defaults.bool(forKey: askOnNewSessionKey)
|
||||
}
|
||||
|
||||
public static func setAskOnNewSession(_ value: Bool, defaults: UserDefaults = .standard) {
|
||||
defaults.set(value, forKey: askOnNewSessionKey)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user