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:
@@ -212,7 +212,21 @@ enum PanelSelfTest {
|
||||
"the window follows the new session")
|
||||
print("PANEL-SELFTEST PASS new-session kept=\(model.pastSessions.count)")
|
||||
|
||||
// Sidebar grouping: today's sessions land in "Today".
|
||||
// Settings reflects the stored defaults: automatic updates and "ask what to
|
||||
// capture" are both on unless the user turned them off.
|
||||
let settingsWindow = makeWindow(
|
||||
width: 460, height: 820,
|
||||
content: AnyView(SettingsView().environment(model)))
|
||||
settingsWindow.orderBack(nil)
|
||||
pump(0.5)
|
||||
let switches = switches(in: settingsWindow.contentView)
|
||||
try check(switches.count >= 2, "settings shows both toggles (found \(switches.count))")
|
||||
try check(switches.allSatisfy { $0.state == .on },
|
||||
"automatic updates and 'ask what to capture' start on")
|
||||
print("PANEL-SELFTEST PASS settings toggles=\(switches.count)")
|
||||
settingsWindow.orderOut(nil)
|
||||
|
||||
// Sidebar grouping: today's sessions land under Today.
|
||||
let groups = model.groupedSections(for: model.sessions(matching: ""))
|
||||
try check(groups.first?.title == "Today", "sessions are grouped under Today")
|
||||
try check(groups.first?.sessions.count == 2, "both sessions are under Today")
|
||||
@@ -346,9 +360,23 @@ enum PanelSelfTest {
|
||||
// MARK: - Window and input helpers
|
||||
|
||||
@MainActor
|
||||
private static func makeWindow(model: AppModel, width: CGFloat, height: CGFloat) -> NSWindow {
|
||||
let hosting = NSHostingController(
|
||||
rootView: SessionsWindowView().environment(model))
|
||||
private static func switches(in view: NSView?) -> [NSSwitch] {
|
||||
guard let view else { return [] }
|
||||
var found: [NSSwitch] = []
|
||||
if let toggle = view as? NSSwitch { found.append(toggle) }
|
||||
for subview in view.subviews {
|
||||
found.append(contentsOf: switches(in: subview))
|
||||
}
|
||||
return found
|
||||
}
|
||||
|
||||
@MainActor
|
||||
private static func makeWindow(
|
||||
width: CGFloat,
|
||||
height: CGFloat,
|
||||
content: AnyView
|
||||
) -> NSWindow {
|
||||
let hosting = NSHostingController(rootView: content)
|
||||
let window = NSWindow(contentViewController: hosting)
|
||||
window.title = "Redline"
|
||||
window.styleMask = [.titled, .closable, .miniaturizable, .resizable]
|
||||
@@ -357,6 +385,14 @@ enum PanelSelfTest {
|
||||
return window
|
||||
}
|
||||
|
||||
@MainActor
|
||||
private static func makeWindow(model: AppModel, width: CGFloat, height: CGFloat) -> NSWindow {
|
||||
makeWindow(
|
||||
width: width, height: height,
|
||||
content: AnyView(SessionsWindowView().environment(model)))
|
||||
}
|
||||
|
||||
|
||||
/// In-process capture of the live window (no Screen Recording permission needed):
|
||||
/// evidence of what the running window actually shows.
|
||||
@MainActor
|
||||
|
||||
Reference in New Issue
Block a user