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
+88 -13
View File
@@ -13,6 +13,28 @@ struct SettingsView: View {
var body: some View {
Form {
Section("Capture") {
LabeledContent("What to capture") {
Picker("What to capture", selection: scopeBinding) {
ForEach(CaptureScope.allCases, id: \.self) { scope in
Text(scope.displayName).tag(scope)
}
}
.labelsHidden()
.pickerStyle(.segmented)
.frame(maxWidth: 240)
}
LabeledContent("Saved area") {
HStack(spacing: 8) {
Text(areaSummary)
.foregroundStyle(.secondary)
.lineLimit(1)
Button("Choose…") {
Task { await model.rePickRegion() }
}
}
}
LabeledContent("Capture shortcut") {
Button {
armHotkeyRecorder()
@@ -23,15 +45,12 @@ struct SettingsView: View {
}
}
LabeledContent("Area") {
HStack(spacing: 8) {
Text(areaSummary)
.foregroundStyle(.secondary)
Button("Choose…") {
Task { await model.rePickRegion() }
}
}
}
Toggle("Ask what to capture on New Session", isOn: askOnNewSessionBinding)
Text("Window and Browser pick the window under the pointer, with the app named. New Session keeps this session and re-asks for the area.")
.font(.caption)
.foregroundStyle(.secondary)
.fixedSize(horizontal: false, vertical: true)
}
Section("Sending") {
@@ -96,9 +115,40 @@ struct SettingsView: View {
.foregroundStyle(.secondary)
.fixedSize(horizontal: false, vertical: true)
}
Section("Updates") {
Toggle("Install updates automatically", isOn: autoInstallBinding)
LabeledContent(updateSummary) {
Button(model.isCheckingForUpdates ? "Checking…" : "Check Now") {
model.checkForUpdates()
}
.disabled(model.isCheckingForUpdates)
}
Text("Updates download in the background and install the next time Redline has no unsent pages. Your area, shortcuts and sessions are kept.")
.font(.caption)
.foregroundStyle(.secondary)
.fixedSize(horizontal: false, vertical: true)
if let update = model.updateAvailable {
LabeledContent("Ready to install") {
Button("Restart Now") { model.installUpdate() }
}
Text("Redline \(update.version) is downloaded and waiting.")
.font(.caption)
.foregroundStyle(.secondary)
}
}
Section {
LabeledContent("Redline \(model.appVersion)") {
Button("Quit Redline") { NSApp.terminate(nil) }
}
}
}
.formStyle(.grouped)
.frame(width: 460, height: 520)
.frame(width: 460, height: 820)
.controlSize(.regular)
.onDisappear { disarmHotkeyRecorder() }
}
@@ -106,8 +156,7 @@ struct SettingsView: View {
// MARK: - Rows
private var areaSummary: String {
guard let region = model.region else { return "Not chosen" }
return "\(Int(region.rect.width)) × \(Int(region.rect.height))"
model.region?.summary ?? "Not chosen"
}
private var oneDrivePath: String {
@@ -152,6 +201,32 @@ struct SettingsView: View {
// MARK: - Bindings
private var scopeBinding: Binding<CaptureScope> {
Binding(
get: { model.captureScope },
set: { scope in Task { await model.chooseCaptureScope(scope) } }
)
}
private var askOnNewSessionBinding: Binding<Bool> {
Binding(
get: { model.askWhatToCaptureOnNewSession },
set: { model.setAskWhatToCaptureOnNewSession($0) }
)
}
private var autoInstallBinding: Binding<Bool> {
Binding(
get: { model.autoInstallUpdates },
set: { model.setAutoInstallUpdates($0) }
)
}
private var updateSummary: String {
let basis = model.updateStatusMessage ?? "Version \(model.appVersion)"
return basis
}
private var transportBinding: Binding<SendTransport> {
Binding(get: { model.transport }, set: { model.chooseTransport($0) })
}
@@ -236,7 +311,7 @@ extension AppModel: SettingsWindowPresenting {
window.title = "Redline Settings"
window.styleMask = [.titled, .closable]
window.isReleasedWhenClosed = false
window.setContentSize(NSSize(width: 460, height: 520))
window.setContentSize(NSSize(width: 460, height: 820))
window.center()
let controller = NSWindowController(window: window)
Self.settingsWindowController = controller