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:
+2
-2
@@ -13,9 +13,9 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.5.0</string>
|
||||
<string>0.6.0</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>7</string>
|
||||
<string>8</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>14.0</string>
|
||||
<key>LSUIElement</key>
|
||||
|
||||
@@ -2,6 +2,19 @@
|
||||
|
||||
A macOS menu-bar app that captures a remembered screen region, builds a one-screenshot-per-page PDF, AirDrops it to an iPad for markup, then watches for the annotated file to come back.
|
||||
|
||||
## What Capture takes
|
||||
|
||||
Four scopes, chosen in the popover (or the window's capture menu) and kept with the session:
|
||||
|
||||
- **Area** — the saved rectangle. `Choose Area…` picks a new one at any time.
|
||||
- **Window** — the window under the pointer. Redline hides itself, dims the screen, names
|
||||
the app under the cursor and highlights its window; click to capture it, Escape cancels.
|
||||
- **Browser** — the front browser window (Safari, Chrome, Edge, Brave, Arc, Firefox,
|
||||
Vivaldi, Opera).
|
||||
- **Screen** — the whole display your saved area is on.
|
||||
|
||||
Window and Browser capture a single window, so nothing overlapping it ends up in the shot.
|
||||
|
||||
## Hotkeys
|
||||
|
||||
- **⌥⇧1** — pick a new region, then capture it.
|
||||
@@ -18,13 +31,19 @@ Two surfaces, two jobs:
|
||||
by day, the selected session's pages in the middle, and its review details, PDF facts
|
||||
and session facts in the inspector. History, text entry and file facts live here
|
||||
because they need room and a window that stays open.
|
||||
- **Settings** (⌘, in the popover's … menu) — capture, sending, and the session age limit.
|
||||
- **Settings** — one door: the gear in the popover header, or ⌘,. Capture, sending,
|
||||
- sessions and updates all live there.
|
||||
- **Updates are automatic.** A downloaded update installs the next time nothing is
|
||||
- waiting to be sent; turn it off in Settings › Updates.
|
||||
|
||||
## Sessions
|
||||
|
||||
Every review is a session. Captures go into the open session; "New Session" closes it
|
||||
and keeps it in the sidebar, named and dated, whether or not it was sent.
|
||||
|
||||
- **New Session** keeps the current captures in their own folder, starts a fresh
|
||||
- session, and immediately asks where to capture (Return keeps the saved area, a drag
|
||||
- picks a new one). Turn that question off in Settings › Capture.
|
||||
- **Nothing is deleted by default.** A session is kept until you delete it.
|
||||
- **Settings > Sessions > Delete after** sets an age limit (7 days … 1 year). Sessions
|
||||
older than the limit are removed on the next launch and by **Clean up now**.
|
||||
@@ -64,7 +83,7 @@ The grant is bound to the bundle identifier `ai.flowmaster.shotdeck` plus the co
|
||||
```bash
|
||||
swift build && swift test
|
||||
./scripts/build-app.sh # signed .app for daily use
|
||||
open .build/Redline.app
|
||||
./scripts/install-local.sh # install it into /Applications and relaunch
|
||||
```
|
||||
|
||||
## Verification scripts
|
||||
|
||||
+131
-20
@@ -44,6 +44,13 @@ public final class AppModel {
|
||||
/// The user's age limit for kept sessions (Settings > Sessions). `.never` until
|
||||
/// the user chooses otherwise, so every session is saved by default.
|
||||
public private(set) var retention: SessionRetention = .never
|
||||
/// What Capture takes: the saved area, the front window, a browser window, or a
|
||||
/// whole display. Kept across sessions; changing it never clears the saved area.
|
||||
public private(set) var captureScope: CaptureScope = .area
|
||||
/// Whether "New Session…" asks what to capture before starting.
|
||||
public private(set) var askWhatToCaptureOnNewSession = true
|
||||
/// Whether a downloaded update installs itself the next time nothing is unsent.
|
||||
public private(set) var autoInstallUpdates = true
|
||||
/// How many archived sessions the current age limit would delete right now.
|
||||
/// Recomputed on launch, on a policy change and after every cleanup.
|
||||
public private(set) var expiredSessionCount: Int = 0
|
||||
@@ -84,6 +91,7 @@ public final class AppModel {
|
||||
let capturer: ScreenCapturer
|
||||
let hotkeys: HotkeyCenter
|
||||
let picker: RegionPickerController
|
||||
let windowPicker = WindowPickerController()
|
||||
let ledger: ReturnLedger
|
||||
let watcher: ReturnWatcher
|
||||
let updateChecker: UpdateChecker
|
||||
@@ -136,6 +144,7 @@ public final class AppModel {
|
||||
guard let self else { return }
|
||||
self.updateAvailable = self.updateChecker.availableUpdate
|
||||
self.setUpdateStatus(self.updateChecker.statusMessage)
|
||||
self.installStagedUpdateIfIdle()
|
||||
}
|
||||
self.updateChecker.onCheckingChanged = { [weak self] checking in
|
||||
self?.isCheckingForUpdates = checking
|
||||
@@ -171,6 +180,7 @@ public final class AppModel {
|
||||
}
|
||||
}
|
||||
func setSelectedSessionID(_ value: UUID?) { selectedSessionID = value }
|
||||
func setCaptureScope(_ scope: CaptureScope) { captureScope = scope }
|
||||
func requestLaneFocus() { laneFocusRequest += 1 }
|
||||
func setFolderDisplayNames(outbox: String, watch: String) {
|
||||
outboxDisplayName = outbox
|
||||
@@ -502,6 +512,9 @@ public final class AppModel {
|
||||
|
||||
public func bootstrap() async {
|
||||
retention = RetentionSettings.load(defaults: retentionDefaults)
|
||||
captureScope = CaptureSettings.scope(defaults: retentionDefaults)
|
||||
askWhatToCaptureOnNewSession = CaptureSettings.askOnNewSession(defaults: retentionDefaults)
|
||||
autoInstallUpdates = UpdateSettings.autoInstall(defaults: retentionDefaults)
|
||||
await spool.setRetention(retention)
|
||||
|
||||
if let data = UserDefaults.standard.data(forKey: CaptureRegion.defaultsKey),
|
||||
@@ -605,6 +618,28 @@ public final class AppModel {
|
||||
}
|
||||
}
|
||||
|
||||
/// Turning automatic updates on/off. On is the default: a staged update installs as
|
||||
/// soon as the app has nothing unsent.
|
||||
public func setAutoInstallUpdates(_ value: Bool) {
|
||||
autoInstallUpdates = value
|
||||
UpdateSettings.setAutoInstall(value, defaults: retentionDefaults)
|
||||
installStagedUpdateIfIdle()
|
||||
}
|
||||
|
||||
/// Installs a staged update when it is safe to restart: nothing captured in the open
|
||||
/// session is waiting to be sent, and no capture or send is in flight. Called after
|
||||
/// every update check, after a send, and after a new session starts — the moments
|
||||
/// the app becomes idle.
|
||||
func installStagedUpdateIfIdle() {
|
||||
guard autoInstallUpdates,
|
||||
updateAvailable != nil,
|
||||
session.isEmpty,
|
||||
!isSending,
|
||||
!isCapturing
|
||||
else { return }
|
||||
updateChecker.installStaged()
|
||||
}
|
||||
|
||||
/// Installs the staged update over `/Applications/Redline.app` and relaunches.
|
||||
/// Does nothing unless the user clicked the menu row.
|
||||
public func installUpdate() {
|
||||
@@ -652,26 +687,44 @@ public final class AppModel {
|
||||
}
|
||||
}
|
||||
|
||||
/// The line shown under the capture control: what the next capture will take.
|
||||
public var captureTargetDescription: String {
|
||||
captureScope.targetDescription(savedArea: region)
|
||||
}
|
||||
|
||||
/// Picks the scope for the session being captured into and persists it. Choosing a
|
||||
/// scope other than Area keeps the saved area untouched.
|
||||
public func chooseCaptureScope(_ scope: CaptureScope) async {
|
||||
captureScope = scope
|
||||
CaptureSettings.setScope(scope, defaults: retentionDefaults)
|
||||
setStatus(nil)
|
||||
if scope == .area, region == nil {
|
||||
await rePickRegion()
|
||||
}
|
||||
}
|
||||
|
||||
public func setAskWhatToCaptureOnNewSession(_ value: Bool) {
|
||||
askWhatToCaptureOnNewSession = value
|
||||
CaptureSettings.setAskOnNewSession(value, defaults: retentionDefaults)
|
||||
}
|
||||
|
||||
public func captureNow() async {
|
||||
await capture(scope: captureScope)
|
||||
}
|
||||
|
||||
/// Captures whatever the chosen scope points at.
|
||||
///
|
||||
/// Any picker runs with Redline's own windows hidden, so the panel never covers —
|
||||
/// or ends up inside — the thing being captured.
|
||||
public func capture(scope: CaptureScope) async {
|
||||
guard !isCapturing else { return }
|
||||
setCapturing(true)
|
||||
defer { setCapturing(false) }
|
||||
|
||||
var target = region
|
||||
if target == nil {
|
||||
target = await withCheckedContinuation { (cont: CheckedContinuation<CaptureRegion?, Never>) in
|
||||
picker.pick { picked in cont.resume(returning: picked) }
|
||||
}
|
||||
guard let picked = target else {
|
||||
setStatus("No region selected.")
|
||||
return
|
||||
}
|
||||
persistRegion(picked)
|
||||
}
|
||||
guard let region = target else { return }
|
||||
|
||||
do {
|
||||
let image = try await capturer.capture(region)
|
||||
let target = try await resolveTarget(for: scope)
|
||||
guard let target else { return }
|
||||
let image = try await capturer.capture(target)
|
||||
let capture = try await spool.append(
|
||||
pngData: image.pngData,
|
||||
pixelWidth: image.pixelWidth,
|
||||
@@ -687,13 +740,71 @@ public final class AppModel {
|
||||
}
|
||||
}
|
||||
|
||||
public func rePickRegion() async {
|
||||
let picked = await withCheckedContinuation { (cont: CheckedContinuation<CaptureRegion?, Never>) in
|
||||
picker.pick { cont.resume(returning: $0) }
|
||||
}
|
||||
guard let picked else { return }
|
||||
/// Works out what to capture, presenting the area or window picker when the scope
|
||||
/// needs one. nil means the user backed out — nothing to say about it.
|
||||
private func resolveTarget(for scope: CaptureScope) async throws -> CaptureTarget? {
|
||||
switch scope {
|
||||
case .area:
|
||||
var area = region
|
||||
if area == nil {
|
||||
area = await pickArea(confirming: nil)
|
||||
guard let picked = area else { return nil }
|
||||
persistRegion(picked)
|
||||
setStatus("Region set: \(Int(picked.rect.width)) × \(Int(picked.rect.height)).")
|
||||
}
|
||||
guard let area else { return nil }
|
||||
return .region(area)
|
||||
|
||||
case .window, .browser:
|
||||
return await pickWindow(onlyBrowsers: scope == .browser)
|
||||
|
||||
case .screen:
|
||||
if let area = region {
|
||||
return .display(displayID: area.displayID)
|
||||
}
|
||||
return .display(displayID: CGMainDisplayID())
|
||||
}
|
||||
}
|
||||
|
||||
/// Hides Redline, runs the area picker, then restores Redline's windows.
|
||||
private func pickArea(confirming saved: CaptureRegion?) async -> CaptureRegion? {
|
||||
RedlineWindows.hideForPicking()
|
||||
defer { RedlineWindows.restoreAfterPicking() }
|
||||
return await withCheckedContinuation { (continuation: CheckedContinuation<CaptureRegion?, Never>) in
|
||||
picker.pick(confirming: saved) { picked in
|
||||
continuation.resume(returning: picked)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Hides Redline, runs the window picker (hover highlights, click chooses), then
|
||||
/// restores Redline's windows.
|
||||
private func pickWindow(onlyBrowsers: Bool) async -> CaptureTarget? {
|
||||
RedlineWindows.hideForPicking()
|
||||
defer { RedlineWindows.restoreAfterPicking() }
|
||||
return await withCheckedContinuation { (continuation: CheckedContinuation<CaptureTarget?, Never>) in
|
||||
windowPicker.pick(onlyBrowsers: onlyBrowsers) { picked in
|
||||
continuation.resume(returning: picked)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Picks a new area and remembers it (the "Choose Area…" action).
|
||||
public func rePickRegion() async {
|
||||
guard let picked = await pickArea(confirming: region) else { return }
|
||||
persistRegion(picked)
|
||||
setStatus("\(picked.summary) saved.")
|
||||
}
|
||||
|
||||
/// One-click "New Session": the current session is kept as a past session (its
|
||||
/// screenshots stay in their own folder and its PDF keeps its name), a fresh one
|
||||
/// opens, and — when the user asked to be asked — the area picker comes straight up
|
||||
/// so the next capture starts with the right area. Return keeps the saved area.
|
||||
public func newSession() async {
|
||||
await startNewSession()
|
||||
guard askWhatToCaptureOnNewSession, captureScope == .area else { return }
|
||||
if let picked = await pickArea(confirming: region) {
|
||||
persistRegion(picked)
|
||||
}
|
||||
}
|
||||
|
||||
public func removeCapture(id: UUID) async {
|
||||
|
||||
@@ -2,26 +2,22 @@ import AppKit
|
||||
import SwiftUI
|
||||
import ShotdeckCore
|
||||
|
||||
/// The menu-bar popover: the current session, and the two things you do with it.
|
||||
///
|
||||
/// Everything else — history, review details, PDF facts — lives in the Redline
|
||||
/// window, which stays open and has room for it.
|
||||
/// The menu-bar popover: decide what to capture, see the pages, then capture or send.
|
||||
/// History, editable details and file facts live in the Redline window; Settings has
|
||||
/// exactly one door — the gear here (⌘, works anywhere).
|
||||
struct MenuBarView: View {
|
||||
@Environment(AppModel.self) private var model
|
||||
|
||||
var body: some View {
|
||||
VStack(alignment: .leading, spacing: 8) {
|
||||
if model.screenRecordingGranted {
|
||||
sessionHeader
|
||||
thumbnailRow
|
||||
statusRow
|
||||
actionRows
|
||||
Divider()
|
||||
footer
|
||||
header
|
||||
scopeControl
|
||||
pageStrip
|
||||
newsRow
|
||||
verbs
|
||||
} else {
|
||||
permissionBlock
|
||||
Divider()
|
||||
footer
|
||||
}
|
||||
}
|
||||
.padding(10)
|
||||
@@ -31,7 +27,7 @@ struct MenuBarView: View {
|
||||
|
||||
// MARK: - Header
|
||||
|
||||
private var sessionHeader: some View {
|
||||
private var header: some View {
|
||||
HStack(alignment: .top, spacing: 8) {
|
||||
VStack(alignment: .leading, spacing: 1) {
|
||||
HStack(spacing: 5) {
|
||||
@@ -50,18 +46,8 @@ struct MenuBarView: View {
|
||||
.foregroundStyle(.secondary)
|
||||
.lineLimit(1)
|
||||
.truncationMode(.tail)
|
||||
.help(detailLine)
|
||||
}
|
||||
Spacer(minLength: 4)
|
||||
if !model.session.isEmpty {
|
||||
Text("\(model.session.captures.count) page\(model.session.captures.count == 1 ? "" : "s")")
|
||||
.font(.caption)
|
||||
.foregroundStyle(.secondary)
|
||||
.monospacedDigit()
|
||||
.padding(.horizontal, 6)
|
||||
.padding(.vertical, 2)
|
||||
.background(.quaternary, in: Capsule())
|
||||
}
|
||||
Button {
|
||||
presentWindow(focusLane: true)
|
||||
} label: {
|
||||
@@ -71,6 +57,17 @@ struct MenuBarView: View {
|
||||
.buttonStyle(.borderless)
|
||||
.help("Edit review details")
|
||||
.accessibilityLabel("Edit review details")
|
||||
|
||||
Button {
|
||||
(model as? SettingsWindowPresenting)?.presentSettingsWindow()
|
||||
} label: {
|
||||
Image(systemName: "gearshape")
|
||||
.font(.system(size: 12, weight: .semibold))
|
||||
}
|
||||
.buttonStyle(.borderless)
|
||||
.keyboardShortcut(",", modifiers: .command)
|
||||
.help("Settings (⌘,)")
|
||||
.accessibilityLabel("Settings")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,20 +86,55 @@ struct MenuBarView: View {
|
||||
var parts: [String] = []
|
||||
if !context.commit.isEmpty { parts.append(context.commit) }
|
||||
if !context.reviewer.isEmpty { parts.append(context.reviewer) }
|
||||
let started = DubaiTime.checkTime(model.session.createdAt)
|
||||
if parts.isEmpty {
|
||||
return "No review details yet · started \(started)"
|
||||
}
|
||||
return parts.joined(separator: " · ") + " · started \(started)"
|
||||
let pages = model.session.captures.count
|
||||
parts.append(pages == 0 ? "no pages" : "\(pages) page\(pages == 1 ? "" : "s")")
|
||||
return parts.joined(separator: " · ")
|
||||
}
|
||||
|
||||
// MARK: - Body
|
||||
// MARK: - What to capture
|
||||
|
||||
private var scopeControl: some View {
|
||||
VStack(alignment: .leading, spacing: 4) {
|
||||
Picker("Capture", selection: scopeBinding) {
|
||||
ForEach(CaptureScope.allCases, id: \.self) { scope in
|
||||
Text(scope.displayName).tag(scope)
|
||||
}
|
||||
}
|
||||
.pickerStyle(.segmented)
|
||||
.labelsHidden()
|
||||
.accessibilityLabel("Capture")
|
||||
|
||||
HStack(spacing: 6) {
|
||||
Text(model.captureTargetDescription)
|
||||
.font(.caption)
|
||||
.foregroundStyle(.secondary)
|
||||
.lineLimit(1)
|
||||
.truncationMode(.tail)
|
||||
Spacer(minLength: 4)
|
||||
if model.captureScope == .area {
|
||||
Button("Choose Area…") {
|
||||
Task { await model.rePickRegion() }
|
||||
}
|
||||
.buttonStyle(.link)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var scopeBinding: Binding<CaptureScope> {
|
||||
Binding(
|
||||
get: { model.captureScope },
|
||||
set: { scope in Task { await model.chooseCaptureScope(scope) } }
|
||||
)
|
||||
}
|
||||
|
||||
// MARK: - Pages
|
||||
|
||||
@ViewBuilder
|
||||
private var thumbnailRow: some View {
|
||||
private var pageStrip: some View {
|
||||
if model.session.isEmpty {
|
||||
VStack(spacing: 2) {
|
||||
Text("Nothing captured yet")
|
||||
Text("No pages yet")
|
||||
.font(.callout)
|
||||
.foregroundStyle(.secondary)
|
||||
Text(emptyHint)
|
||||
@@ -117,28 +149,26 @@ struct MenuBarView: View {
|
||||
}
|
||||
|
||||
private var emptyHint: String {
|
||||
guard let region = model.region else {
|
||||
return "\(model.hotkeyDisplayString) picks an area, then captures it"
|
||||
}
|
||||
return "\(model.hotkeyDisplayString) captures \(Int(region.rect.width)) × \(Int(region.rect.height)) on \(displayName(for: region))"
|
||||
"\(model.hotkeyDisplayString) captures the \(model.captureScope.displayName.lowercased())"
|
||||
}
|
||||
|
||||
private func displayName(for region: CaptureRegion) -> String {
|
||||
for (index, screen) in NSScreen.screens.enumerated() {
|
||||
let id = (screen.deviceDescription[NSDeviceDescriptionKey("NSScreenNumber")] as? NSNumber)?
|
||||
.uint32Value
|
||||
if id == region.displayID {
|
||||
return "Display \(index + 1)"
|
||||
}
|
||||
}
|
||||
return "Display 1"
|
||||
}
|
||||
// MARK: - News
|
||||
|
||||
/// One line, only when there is something to say: the last action's result, or a
|
||||
/// PDF that came back with marks.
|
||||
@ViewBuilder
|
||||
private var statusRow: some View {
|
||||
if let status = model.statusLine, !status.isEmpty {
|
||||
private var newsRow: some View {
|
||||
if let update = model.updateAvailable {
|
||||
HStack(spacing: 6) {
|
||||
Circle().fill(.green).frame(width: 6, height: 6)
|
||||
Text(model.autoInstallUpdates
|
||||
? "Redline \(update.version) is ready — restarts when nothing is unsent"
|
||||
: "Redline \(update.version) is ready")
|
||||
.font(.caption)
|
||||
.lineLimit(2)
|
||||
Spacer(minLength: 4)
|
||||
Button("Restart Now") { model.installUpdate() }
|
||||
.buttonStyle(.link)
|
||||
}
|
||||
} else if let status = model.statusLine, !status.isEmpty {
|
||||
Text(status)
|
||||
.font(.caption)
|
||||
.foregroundStyle(.secondary)
|
||||
@@ -147,7 +177,9 @@ struct MenuBarView: View {
|
||||
}
|
||||
}
|
||||
|
||||
private var actionRows: some View {
|
||||
// MARK: - Verbs
|
||||
|
||||
private var verbs: some View {
|
||||
VStack(spacing: 6) {
|
||||
HStack(spacing: 6) {
|
||||
Button {
|
||||
@@ -165,10 +197,7 @@ struct MenuBarView: View {
|
||||
.disabled(model.isCapturing)
|
||||
|
||||
Button {
|
||||
guard let sender = model as? SendCapable else {
|
||||
model.setStatus("Send is not available in this build.")
|
||||
return
|
||||
}
|
||||
guard let sender = model as? SendCapable else { return }
|
||||
let anchor = NSApp.keyWindow?.contentView
|
||||
Task { await sender.send(anchor: anchor) }
|
||||
} label: {
|
||||
@@ -185,7 +214,7 @@ struct MenuBarView: View {
|
||||
|
||||
HStack(spacing: 6) {
|
||||
Button {
|
||||
Task { await model.startNewSession() }
|
||||
Task { await model.newSession() }
|
||||
} label: {
|
||||
HStack(spacing: 4) {
|
||||
Image(systemName: "plus.square.on.square")
|
||||
@@ -194,8 +223,8 @@ struct MenuBarView: View {
|
||||
.frame(maxWidth: .infinity)
|
||||
}
|
||||
.controlSize(.regular)
|
||||
.disabled(!model.canStartNewSession)
|
||||
.help("Keeps this session and starts a fresh one. Nothing is deleted.")
|
||||
.disabled(model.isSending)
|
||||
.help("Keeps this session and starts a fresh one, then asks where to capture.")
|
||||
|
||||
Button {
|
||||
presentWindow(focusLane: false)
|
||||
@@ -219,53 +248,7 @@ struct MenuBarView: View {
|
||||
return model.transport == .oneDrive ? "Save \(pages)…" : "Send \(pages)…"
|
||||
}
|
||||
|
||||
// MARK: - Footer
|
||||
|
||||
private var footer: some View {
|
||||
HStack(spacing: 6) {
|
||||
Text("\(sendChannel) · \(model.retentionSummary)")
|
||||
.font(.caption)
|
||||
.foregroundStyle(.secondary)
|
||||
.lineLimit(1)
|
||||
.truncationMode(.tail)
|
||||
Spacer(minLength: 4)
|
||||
Menu {
|
||||
Button("Settings…") {
|
||||
(model as? SettingsWindowPresenting)?.presentSettingsWindow()
|
||||
}
|
||||
.keyboardShortcut(",", modifiers: .command)
|
||||
Button(model.isCheckingForUpdates ? "Checking for Updates…" : "Check for Updates…") {
|
||||
model.checkForUpdates()
|
||||
}
|
||||
.disabled(model.isCheckingForUpdates)
|
||||
if let update = model.updateAvailable {
|
||||
Button("Update to \(update.version)") { model.installUpdate() }
|
||||
}
|
||||
if let previous = model.previousVersion {
|
||||
Button("Revert to \(previous)") { model.revertToPreviousVersion() }
|
||||
}
|
||||
Divider()
|
||||
Button("Quit Redline") { NSApp.terminate(nil) }
|
||||
.keyboardShortcut("q", modifiers: .command)
|
||||
} label: {
|
||||
Image(systemName: "ellipsis.circle")
|
||||
}
|
||||
.menuStyle(.borderlessButton)
|
||||
.menuIndicator(.hidden)
|
||||
.fixedSize()
|
||||
.help("More Redline actions")
|
||||
.accessibilityLabel("More")
|
||||
}
|
||||
.overlay(alignment: .topTrailing) {
|
||||
EmptyView()
|
||||
}
|
||||
}
|
||||
|
||||
private var sendChannel: String {
|
||||
model.transport == .oneDrive ? "Saves to OneDrive" : "Sends via AirDrop"
|
||||
}
|
||||
|
||||
// MARK: - Not granted
|
||||
// MARK: - Permission
|
||||
|
||||
private var permissionBlock: some View {
|
||||
HStack(alignment: .top, spacing: 6) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -78,7 +78,7 @@ enum PanelSnapshot {
|
||||
SettingsView().environment(model),
|
||||
to: directory.appendingPathComponent("panel-06-settings.png"),
|
||||
width: 460,
|
||||
height: 560
|
||||
height: 820
|
||||
)
|
||||
|
||||
// 06b — the sessions window: real sidebar, pages grid and inspector.
|
||||
@@ -162,7 +162,7 @@ enum PanelSnapshot {
|
||||
SettingsView().environment(model),
|
||||
to: directory.appendingPathComponent("panel-07-settings-onedrive.png"),
|
||||
width: 460,
|
||||
height: 560
|
||||
height: 820
|
||||
)
|
||||
|
||||
// 08 — no OneDrive folder found: a fake home with NO Library/CloudStorage at
|
||||
@@ -183,7 +183,7 @@ enum PanelSnapshot {
|
||||
SettingsView().environment(model),
|
||||
to: directory.appendingPathComponent("panel-08-settings-onedrive-missing.png"),
|
||||
width: 460,
|
||||
height: 560
|
||||
height: 820
|
||||
)
|
||||
|
||||
// 09 — menu bar panel, 3 captures present, OneDrive mode ("Send to OneDrive").
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -146,15 +146,51 @@ struct SessionsWindowView: View {
|
||||
.help(showInspector ? "Hide the inspector" : "Show the inspector")
|
||||
.accessibilityLabel(showInspector ? "Hide the inspector" : "Show the inspector")
|
||||
|
||||
// What the next capture takes, in the same place as the verbs.
|
||||
Menu {
|
||||
ForEach(CaptureScope.allCases, id: \.self) { scope in
|
||||
Button {
|
||||
Task { await model.startNewSession() }
|
||||
Task {
|
||||
await model.chooseCaptureScope(scope)
|
||||
await model.captureNow()
|
||||
}
|
||||
} label: {
|
||||
Text("\(scope.menuTitle) — capture now")
|
||||
}
|
||||
}
|
||||
Divider()
|
||||
Button("Choose New Area…") {
|
||||
Task { await model.rePickRegion() }
|
||||
}
|
||||
} label: {
|
||||
HStack(spacing: 4) {
|
||||
Image(systemName: scopeSymbol)
|
||||
Text("\(model.captureScope.displayName) · \(scopeDetail)")
|
||||
.lineLimit(1)
|
||||
}
|
||||
}
|
||||
.menuStyle(.borderlessButton)
|
||||
.fixedSize()
|
||||
.help("What Capture takes")
|
||||
.accessibilityLabel("Capture: \(model.captureTargetDescription)")
|
||||
|
||||
if model.captureScope == .area {
|
||||
Button("Choose Area…") {
|
||||
Task { await model.rePickRegion() }
|
||||
}
|
||||
.fixedSize()
|
||||
.help("Pick a new area to capture")
|
||||
}
|
||||
|
||||
Button {
|
||||
Task { await model.newSession() }
|
||||
} label: {
|
||||
Label("New Session", systemImage: "plus.square.on.square")
|
||||
}
|
||||
.keyboardShortcut("n", modifiers: .command)
|
||||
.disabled(!model.canStartNewSession)
|
||||
.disabled(model.isSending)
|
||||
.fixedSize()
|
||||
.help("Keep this session and start a fresh one (⌘N)")
|
||||
.help("Keep this session and start a fresh one, then ask where to capture (⌘N)")
|
||||
|
||||
Button {
|
||||
Task { await model.captureNow() }
|
||||
@@ -199,6 +235,29 @@ struct SessionsWindowView: View {
|
||||
model.transport == .oneDrive ? "Save…" : "Send…"
|
||||
}
|
||||
|
||||
private var scopeSymbol: String {
|
||||
switch model.captureScope {
|
||||
case .area: return "rectangle.dashed"
|
||||
case .window: return "macwindow"
|
||||
case .browser: return "safari"
|
||||
case .screen: return "display"
|
||||
}
|
||||
}
|
||||
|
||||
/// Short form for the header: the area size, or what a window scope grabs.
|
||||
private var scopeDetail: String {
|
||||
switch model.captureScope {
|
||||
case .area:
|
||||
guard let region = model.region else { return "not set" }
|
||||
return "\(Int(region.rect.width)) × \(Int(region.rect.height))"
|
||||
case .window: return "front window"
|
||||
case .browser: return "browser"
|
||||
case .screen:
|
||||
guard let region = model.region else { return "all" }
|
||||
return "Display \(region.displayNumber)"
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Pages
|
||||
|
||||
@ViewBuilder
|
||||
|
||||
@@ -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)
|
||||
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)
|
||||
Button("Choose…") {
|
||||
Task { await model.rePickRegion() }
|
||||
}
|
||||
}
|
||||
}
|
||||
.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
|
||||
|
||||
@@ -0,0 +1,252 @@
|
||||
import AppKit
|
||||
import ShotdeckCore
|
||||
|
||||
/// Hides Redline's own windows while the user is choosing what to capture, then puts
|
||||
/// them back. The popover would otherwise sit on top of the thing being picked and,
|
||||
/// worse, end up inside the screenshot.
|
||||
@MainActor
|
||||
enum RedlineWindows {
|
||||
private static var hidden: [NSWindow] = []
|
||||
|
||||
static func hideForPicking() {
|
||||
hidden = NSApp.windows.filter { window in
|
||||
window.isVisible && !(window is RegionPickerWindow)
|
||||
}
|
||||
for window in hidden {
|
||||
window.orderOut(nil)
|
||||
}
|
||||
}
|
||||
|
||||
static func restoreAfterPicking() {
|
||||
for window in hidden where !window.isVisible {
|
||||
window.orderFront(nil)
|
||||
}
|
||||
hidden = []
|
||||
}
|
||||
}
|
||||
|
||||
/// Highlights the window under the pointer and captures the one the user clicks —
|
||||
/// an app window, a browser window with its active tab, or the whole screen when the
|
||||
/// pointer is over the desktop.
|
||||
@MainActor
|
||||
public final class WindowPickerController {
|
||||
private var windows: [RegionPickerWindow] = []
|
||||
private var monitor: Any?
|
||||
private var hoverTimer: Timer?
|
||||
private var completion: (@MainActor (CaptureTarget?) -> Void)?
|
||||
private var candidates: [WindowCandidate] = []
|
||||
private var primaryHeight: CGFloat = 0
|
||||
private var hovered: WindowCandidate?
|
||||
private var hoveredScreen: NSScreen?
|
||||
|
||||
public init() {}
|
||||
|
||||
/// Presents the picker. The completion receives the chosen target, or nil when the
|
||||
/// user pressed Escape.
|
||||
public func pick(
|
||||
onlyBrowsers: Bool = false,
|
||||
completion: @escaping @MainActor (CaptureTarget?) -> Void
|
||||
) {
|
||||
if self.completion != nil {
|
||||
finish(target: nil)
|
||||
}
|
||||
self.completion = completion
|
||||
self.primaryHeight = NSScreen.screens.first?.frame.height ?? 0
|
||||
|
||||
let all = ScreenCapturer.onScreenWindows().filter { candidate in
|
||||
candidate.layer == 0
|
||||
&& candidate.ownerBundleID != CaptureTargetResolver.ownBundleID
|
||||
&& candidate.frame.width >= 40
|
||||
&& candidate.frame.height >= 40
|
||||
}
|
||||
self.candidates = onlyBrowsers
|
||||
? all.filter { candidate in
|
||||
guard let bundle = candidate.ownerBundleID else { return false }
|
||||
return CaptureTargetResolver.browserBundleIDs.contains(bundle)
|
||||
}
|
||||
: all
|
||||
|
||||
presentOverlays()
|
||||
}
|
||||
|
||||
// MARK: - Overlays
|
||||
|
||||
private func presentOverlays() {
|
||||
let screens = NSScreen.screens
|
||||
guard !screens.isEmpty else {
|
||||
finish(target: nil)
|
||||
return
|
||||
}
|
||||
windows = screens.map { RegionPickerWindow(screen: $0) }
|
||||
for window in windows {
|
||||
window.orderFrontRegardless()
|
||||
}
|
||||
let mouse = NSEvent.mouseLocation
|
||||
let keyWindow = windows.first { $0.coveringScreen.frame.contains(mouse) } ?? windows[0]
|
||||
keyWindow.makeKey()
|
||||
|
||||
// A timer drives the highlight from the real pointer position: mouse-moved
|
||||
// events are only delivered to the key window, and the overlay must track the
|
||||
// pointer even over another app's window.
|
||||
hoverTimer?.invalidate()
|
||||
hoverTimer = Timer.scheduledTimer(withTimeInterval: 1.0 / 60.0, repeats: true) {
|
||||
[weak self] _ in
|
||||
MainActor.assumeIsolated {
|
||||
self?.updateHover(at: NSEvent.mouseLocation)
|
||||
}
|
||||
}
|
||||
|
||||
monitor = NSEvent.addLocalMonitorForEvents(
|
||||
matching: [.mouseMoved, .leftMouseDown, .keyDown]
|
||||
) { [weak self] event in
|
||||
guard let self else { return event }
|
||||
let type = event.type
|
||||
let keyCode: UInt16 = (type == .keyDown) ? event.keyCode : 0
|
||||
let locationInWindow = event.locationInWindow
|
||||
let windowNumber = event.windowNumber
|
||||
let consume = MainActor.assumeIsolated {
|
||||
let location = self.globalAppKitLocation(
|
||||
locationInWindow: locationInWindow, windowNumber: windowNumber)
|
||||
return self.handle(type: type, keyCode: keyCode, location: location)
|
||||
}
|
||||
return consume ? nil : event
|
||||
}
|
||||
|
||||
updateHover(at: mouse)
|
||||
}
|
||||
|
||||
private func handle(type: NSEvent.EventType, keyCode: UInt16, location: NSPoint?) -> Bool {
|
||||
switch type {
|
||||
case .keyDown:
|
||||
if keyCode == 53 { // Escape
|
||||
finish(target: nil)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
case .mouseMoved:
|
||||
updateHover(at: location ?? NSEvent.mouseLocation)
|
||||
return false
|
||||
case .leftMouseDown:
|
||||
if let target = targetUnderPointer(at: location ?? NSEvent.mouseLocation) {
|
||||
finish(target: target)
|
||||
}
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Hover
|
||||
|
||||
private func updateHover(at point: NSPoint) {
|
||||
let screen = NSScreen.screens.first { $0.frame.contains(point) }
|
||||
let candidate = candidate(at: point)
|
||||
hovered = candidate
|
||||
hoveredScreen = screen
|
||||
|
||||
let highlightRect = candidate.map { appKitRect($0.frame) } ?? screen?.frame
|
||||
let chip: String
|
||||
if let candidate {
|
||||
let app = appName(for: candidate)
|
||||
let title = windowTitle(for: candidate)
|
||||
chip = title.isEmpty ? app : "\(app) — \(title)"
|
||||
} else {
|
||||
chip = "Entire Screen"
|
||||
}
|
||||
|
||||
for window in windows {
|
||||
guard let windowScreen = windows.first(where: { $0 === window })?.coveringScreen
|
||||
else { continue }
|
||||
guard let highlightRect, windowScreen.frame.intersects(highlightRect) else {
|
||||
window.updateSelection(localRect: nil, sizeText: nil)
|
||||
continue
|
||||
}
|
||||
let local = CGRect(
|
||||
x: highlightRect.minX - windowScreen.frame.minX,
|
||||
y: highlightRect.minY - windowScreen.frame.minY,
|
||||
width: highlightRect.width,
|
||||
height: highlightRect.height
|
||||
)
|
||||
window.updateSelection(localRect: local, sizeText: chip)
|
||||
}
|
||||
}
|
||||
|
||||
private func targetUnderPointer(at point: NSPoint) -> CaptureTarget? {
|
||||
if let candidate = candidate(at: point) {
|
||||
return .window(
|
||||
windowID: candidate.windowID,
|
||||
frame: candidate.frame,
|
||||
displayID: CaptureTargetResolver.displayID(containing: candidate.frame)
|
||||
)
|
||||
}
|
||||
guard let screen = NSScreen.screens.first(where: { $0.frame.contains(point) }) else {
|
||||
return nil
|
||||
}
|
||||
return .display(displayID: displayID(for: screen))
|
||||
}
|
||||
|
||||
private func candidate(at point: NSPoint) -> WindowCandidate? {
|
||||
candidates.first { candidate in
|
||||
appKitRect(candidate.frame).contains(point)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Geometry and labels
|
||||
|
||||
private func appKitRect(_ cgRect: CGRect) -> CGRect {
|
||||
CGRect(
|
||||
x: cgRect.minX,
|
||||
y: primaryHeight - cgRect.minY - cgRect.height,
|
||||
width: cgRect.width,
|
||||
height: cgRect.height
|
||||
)
|
||||
}
|
||||
|
||||
private func displayID(for screen: NSScreen) -> UInt32 {
|
||||
(screen.deviceDescription[NSDeviceDescriptionKey("NSScreenNumber")] as? NSNumber)?
|
||||
.uint32Value ?? CGMainDisplayID()
|
||||
}
|
||||
|
||||
private func appName(for candidate: WindowCandidate) -> String {
|
||||
guard let bundle = candidate.ownerBundleID,
|
||||
let url = NSWorkspace.shared.urlForApplication(withBundleIdentifier: bundle)
|
||||
else { return "Window" }
|
||||
return FileManager.default.displayName(atPath: url.path)
|
||||
.replacingOccurrences(of: ".app", with: "")
|
||||
}
|
||||
|
||||
private func windowTitle(for candidate: WindowCandidate) -> String {
|
||||
guard let raw = CGWindowListCopyWindowInfo([.optionIncludingWindow], candidate.windowID)
|
||||
as? [[String: Any]], let first = raw.first
|
||||
else { return "" }
|
||||
return first[kCGWindowName as String] as? String ?? ""
|
||||
}
|
||||
|
||||
private func globalAppKitLocation(locationInWindow: NSPoint, windowNumber: Int) -> NSPoint? {
|
||||
if let window = windows.first(where: { $0.windowNumber == windowNumber }) {
|
||||
return window.convertPoint(toScreen: locationInWindow)
|
||||
}
|
||||
if windowNumber != 0, let window = NSApp.window(withWindowNumber: windowNumber) {
|
||||
return window.convertPoint(toScreen: locationInWindow)
|
||||
}
|
||||
return NSEvent.mouseLocation
|
||||
}
|
||||
|
||||
// MARK: - Finish
|
||||
|
||||
private func finish(target: CaptureTarget?) {
|
||||
hoverTimer?.invalidate()
|
||||
hoverTimer = nil
|
||||
if let monitor {
|
||||
NSEvent.removeMonitor(monitor)
|
||||
}
|
||||
monitor = nil
|
||||
for window in windows {
|
||||
window.orderOut(nil)
|
||||
}
|
||||
windows = []
|
||||
let completion = self.completion
|
||||
self.completion = nil
|
||||
completion?(target)
|
||||
}
|
||||
}
|
||||
@@ -55,4 +55,20 @@ public struct CaptureRegion: Codable, Sendable, Equatable {
|
||||
|
||||
/// Persisted in UserDefaults under this key BY THE APP (WP-4a), never by this type.
|
||||
public static let defaultsKey = "ai.flowmaster.shotdeck.region"
|
||||
|
||||
/// 1-based position of this region's display in the current screen list; 1 when the
|
||||
/// display is no longer attached.
|
||||
public var displayNumber: Int {
|
||||
let match = NSScreen.screens.firstIndex { screen in
|
||||
let id = (screen.deviceDescription[NSDeviceDescriptionKey("NSScreenNumber")]
|
||||
as? NSNumber)?.uint32Value
|
||||
return id == displayID
|
||||
}
|
||||
return (match ?? 0) + 1
|
||||
}
|
||||
|
||||
/// "800 × 600 on Display 1" — the line the popover shows under the capture control.
|
||||
public var summary: String {
|
||||
String(format: "%.0f × %.0f on Display %d", rect.width, rect.height, displayNumber)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
import CoreGraphics
|
||||
import Foundation
|
||||
|
||||
/// One on-screen window as the capture resolver sees it. Kept as plain data so the
|
||||
/// choice logic is testable without a window server.
|
||||
public struct WindowCandidate: Sendable, Equatable {
|
||||
public let windowID: UInt32
|
||||
public let ownerBundleID: String?
|
||||
public let ownerPID: Int32
|
||||
public let frame: CGRect
|
||||
public let layer: Int
|
||||
|
||||
public init(
|
||||
windowID: UInt32,
|
||||
ownerBundleID: String?,
|
||||
ownerPID: Int32,
|
||||
frame: CGRect,
|
||||
layer: Int
|
||||
) {
|
||||
self.windowID = windowID
|
||||
self.ownerBundleID = ownerBundleID
|
||||
self.ownerPID = ownerPID
|
||||
self.frame = frame
|
||||
self.layer = layer
|
||||
}
|
||||
}
|
||||
|
||||
/// What a capture will take: one region of a display, one whole display, or one window.
|
||||
public enum CaptureTarget: Sendable, Equatable {
|
||||
case region(CaptureRegion)
|
||||
case display(displayID: UInt32)
|
||||
case window(windowID: UInt32, frame: CGRect, displayID: UInt32)
|
||||
}
|
||||
|
||||
/// Chooses the capture target for a scope from the windows that are on screen.
|
||||
///
|
||||
/// Candidates arrive front-to-back (the order the window server reports), which is what
|
||||
/// makes "the front window" well defined. Redline's own windows are never candidates,
|
||||
/// so choosing Window never captures the app's own panel.
|
||||
public enum CaptureTargetResolver {
|
||||
/// Bundles whose front window counts as a browser page.
|
||||
public static let browserBundleIDs: Set<String> = [
|
||||
"com.apple.Safari",
|
||||
"com.google.Chrome",
|
||||
"com.google.Chrome.canary",
|
||||
"com.microsoft.edgemac",
|
||||
"com.brave.Browser",
|
||||
"company.thebrowser.Browser",
|
||||
"org.mozilla.firefox",
|
||||
"com.vivaldi.Vivaldi",
|
||||
"com.operasoftware.Opera",
|
||||
]
|
||||
|
||||
/// Redline's own bundle identifier — never a capture target.
|
||||
public static let ownBundleID = "ai.flowmaster.shotdeck"
|
||||
|
||||
public static func resolve(
|
||||
scope: CaptureScope,
|
||||
savedArea: CaptureRegion?,
|
||||
frontmostPID: Int32,
|
||||
candidates: [WindowCandidate]
|
||||
) throws -> CaptureTarget {
|
||||
let usable = candidates.filter { candidate in
|
||||
candidate.layer == 0
|
||||
&& candidate.ownerBundleID != ownBundleID
|
||||
&& candidate.frame.width >= 40
|
||||
&& candidate.frame.height >= 40
|
||||
}
|
||||
|
||||
switch scope {
|
||||
case .area:
|
||||
guard let savedArea else { throw ShotdeckError.noRegionRemembered }
|
||||
return .region(savedArea)
|
||||
|
||||
case .screen:
|
||||
if let savedArea {
|
||||
return .display(displayID: savedArea.displayID)
|
||||
}
|
||||
guard let window = usable.first else { throw ShotdeckError.noFrontWindow }
|
||||
return .display(displayID: displayID(containing: window.frame))
|
||||
|
||||
case .window:
|
||||
let ownAppFirst = usable.first { $0.ownerPID == frontmostPID }
|
||||
guard let window = ownAppFirst ?? usable.first else {
|
||||
throw ShotdeckError.noFrontWindow
|
||||
}
|
||||
return .window(
|
||||
windowID: window.windowID,
|
||||
frame: window.frame,
|
||||
displayID: displayID(containing: window.frame)
|
||||
)
|
||||
|
||||
case .browser:
|
||||
guard let window = usable.first(where: {
|
||||
guard let bundle = $0.ownerBundleID else { return false }
|
||||
return browserBundleIDs.contains(bundle)
|
||||
}) else {
|
||||
throw ShotdeckError.noBrowserWindow
|
||||
}
|
||||
return .window(
|
||||
windowID: window.windowID,
|
||||
frame: window.frame,
|
||||
displayID: displayID(containing: window.frame)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/// The display whose bounds contain the window's centre; the main display when a
|
||||
/// window straddles two screens and belongs to neither cleanly.
|
||||
public static func displayID(containing frame: CGRect) -> UInt32 {
|
||||
let centre = CGPoint(x: frame.midX, y: frame.midY)
|
||||
var count: UInt32 = 0
|
||||
guard CGGetActiveDisplayList(0, nil, &count) == .success, count > 0 else {
|
||||
return CGMainDisplayID()
|
||||
}
|
||||
var displays = [CGDirectDisplayID](repeating: 0, count: Int(count))
|
||||
guard CGGetActiveDisplayList(count, &displays, &count) == .success else {
|
||||
return CGMainDisplayID()
|
||||
}
|
||||
for display in displays.prefix(Int(count)) where CGDisplayBounds(display).contains(centre) {
|
||||
return display
|
||||
}
|
||||
return CGMainDisplayID()
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,135 @@ public struct ScreenCapturer: Sendable {
|
||||
/// Does NOT prompt. Reports the current Screen Recording grant.
|
||||
public static var isScreenRecordingGranted: Bool { CGPreflightScreenCaptureAccess() }
|
||||
|
||||
/// Captures whatever the given scope points at, resolving it right now.
|
||||
public func capture(
|
||||
_ scope: CaptureScope,
|
||||
savedArea: CaptureRegion?
|
||||
) async throws -> CapturedImage {
|
||||
guard Self.isScreenRecordingGranted else {
|
||||
throw ShotdeckError.screenRecordingNotGranted
|
||||
}
|
||||
let frontmostPID = NSWorkspace.shared.frontmostApplication?.processIdentifier ?? 0
|
||||
let target = try CaptureTargetResolver.resolve(
|
||||
scope: scope,
|
||||
savedArea: savedArea,
|
||||
frontmostPID: frontmostPID,
|
||||
candidates: Self.onScreenWindows()
|
||||
)
|
||||
return try await capture(target)
|
||||
}
|
||||
|
||||
/// Captures one resolved target. A window is captured window-only (so an overlapping
|
||||
/// window never ends up in a review shot); a region or a display goes through the
|
||||
/// display path.
|
||||
public func capture(_ target: CaptureTarget) async throws -> CapturedImage {
|
||||
guard Self.isScreenRecordingGranted else {
|
||||
throw ShotdeckError.screenRecordingNotGranted
|
||||
}
|
||||
switch target {
|
||||
case .region(let region):
|
||||
return try await capture(region)
|
||||
case .display(let displayID):
|
||||
let bounds = CGDisplayBounds(displayID)
|
||||
return try await capture(
|
||||
CaptureRegion(
|
||||
displayID: displayID, rect: bounds,
|
||||
capturedScale: Self.backingScale(for: displayID)))
|
||||
case .window(let windowID, let frame, let displayID):
|
||||
return try await captureWindow(
|
||||
windowID: windowID, frame: frame, displayID: displayID)
|
||||
}
|
||||
}
|
||||
|
||||
/// On-screen windows, front-most first, as plain data for the resolver.
|
||||
public static func onScreenWindows() -> [WindowCandidate] {
|
||||
guard let raw = CGWindowListCopyWindowInfo(
|
||||
[.optionOnScreenOnly, .excludeDesktopElements], kCGNullWindowID
|
||||
) as? [[String: Any]] else { return [] }
|
||||
|
||||
return raw.compactMap { entry in
|
||||
guard let windowID = (entry[kCGWindowNumber as String] as? NSNumber)?.uint32Value,
|
||||
let ownerPID = (entry[kCGWindowOwnerPID as String] as? NSNumber)?.int32Value,
|
||||
let boundsDict = entry[kCGWindowBounds as String] as? [String: Any],
|
||||
let layer = (entry[kCGWindowLayer as String] as? NSNumber)?.intValue
|
||||
else { return nil }
|
||||
let frame = CGRect(
|
||||
x: boundsDict["X"] as? Double ?? 0,
|
||||
y: boundsDict["Y"] as? Double ?? 0,
|
||||
width: boundsDict["Width"] as? Double ?? 0,
|
||||
height: boundsDict["Height"] as? Double ?? 0
|
||||
)
|
||||
return WindowCandidate(
|
||||
windowID: windowID,
|
||||
ownerBundleID: bundleIdentifier(forPID: ownerPID),
|
||||
ownerPID: ownerPID,
|
||||
frame: frame,
|
||||
layer: layer
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
private static func bundleIdentifier(forPID pid: Int32) -> String? {
|
||||
NSRunningApplication(processIdentifier: pid)?.bundleIdentifier
|
||||
}
|
||||
|
||||
private static func backingScale(for displayID: UInt32) -> CGFloat {
|
||||
guard let mode = CGDisplayCopyDisplayMode(displayID), mode.width > 0 else { return 2 }
|
||||
return CGFloat(mode.pixelWidth) / CGFloat(mode.width)
|
||||
}
|
||||
|
||||
/// Captures a single window through ScreenCaptureKit's window filter, at the display's
|
||||
/// backing scale, without the window server compositing anything on top of it.
|
||||
private func captureWindow(
|
||||
windowID: UInt32,
|
||||
frame: CGRect,
|
||||
displayID: UInt32
|
||||
) async throws -> CapturedImage {
|
||||
let content: SCShareableContent
|
||||
do {
|
||||
content = try await SCShareableContent.excludingDesktopWindows(
|
||||
false, onScreenWindowsOnly: true)
|
||||
} catch {
|
||||
throw ShotdeckError.captureFailed(underlying: error.localizedDescription)
|
||||
}
|
||||
guard let window = content.windows.first(where: { $0.windowID == windowID }) else {
|
||||
throw ShotdeckError.noFrontWindow
|
||||
}
|
||||
|
||||
let scale = Self.backingScale(for: displayID)
|
||||
let filter = SCContentFilter(desktopIndependentWindow: window)
|
||||
let configuration = SCStreamConfiguration()
|
||||
configuration.width = Int((frame.width * scale).rounded())
|
||||
configuration.height = Int((frame.height * scale).rounded())
|
||||
configuration.showsCursor = false
|
||||
configuration.scalesToFit = false
|
||||
|
||||
let cgImage: CGImage
|
||||
do {
|
||||
cgImage = try await SCScreenshotManager.captureImage(
|
||||
contentFilter: filter, configuration: configuration)
|
||||
} catch {
|
||||
throw ShotdeckError.captureFailed(underlying: error.localizedDescription)
|
||||
}
|
||||
|
||||
let data = NSMutableData()
|
||||
guard let dest = CGImageDestinationCreateWithData(
|
||||
data, UTType.png.identifier as CFString, 1, nil
|
||||
) else {
|
||||
throw ShotdeckError.captureFailed(underlying: "could not create PNG image destination")
|
||||
}
|
||||
CGImageDestinationAddImage(dest, cgImage, nil)
|
||||
guard CGImageDestinationFinalize(dest) else {
|
||||
throw ShotdeckError.captureFailed(underlying: "PNG encoding failed to finalize")
|
||||
}
|
||||
return CapturedImage(
|
||||
pngData: data as Data,
|
||||
pixelWidth: cgImage.width,
|
||||
pixelHeight: cgImage.height,
|
||||
scale: scale
|
||||
)
|
||||
}
|
||||
|
||||
/// Captures `region` at the display's true backing scale. Throws
|
||||
/// `.screenRecordingNotGranted` when the grant is absent — never requests it.
|
||||
public func capture(_ region: CaptureRegion) async throws -> CapturedImage {
|
||||
|
||||
@@ -11,6 +11,8 @@ public enum ShotdeckError: Error, LocalizedError, Sendable {
|
||||
case airDropUnavailable
|
||||
case noCommentedReturns
|
||||
case oneDriveFolderUnavailable(path: String)
|
||||
case noFrontWindow
|
||||
case noBrowserWindow
|
||||
|
||||
public var errorDescription: String? {
|
||||
switch self {
|
||||
@@ -34,6 +36,10 @@ public enum ShotdeckError: Error, LocalizedError, Sendable {
|
||||
return "None of the returned PDFs have comments on them."
|
||||
case .oneDriveFolderUnavailable(let path):
|
||||
return "Your OneDrive folder is not available: \(path). Check that OneDrive is signed in, or choose another folder in Settings."
|
||||
case .noFrontWindow:
|
||||
return "There is no front window to capture. Click the window you want first, or choose Area."
|
||||
case .noBrowserWindow:
|
||||
return "No browser window is open. Open the page you want, or choose Window or Area."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import Foundation
|
||||
|
||||
/// Whether Redline installs a staged update by itself.
|
||||
///
|
||||
/// On by default: updates download in the background and install the next time the app
|
||||
/// has nothing unsent, so the tool stays current without anyone chasing a menu row.
|
||||
/// Off means the staged update waits for the "Update to X" action.
|
||||
public enum UpdateSettings {
|
||||
public static let autoInstallKey = "ai.flowmaster.shotdeck.autoInstallUpdates"
|
||||
|
||||
public static func autoInstall(defaults: UserDefaults = .standard) -> Bool {
|
||||
guard defaults.object(forKey: autoInstallKey) != nil else { return true }
|
||||
return defaults.bool(forKey: autoInstallKey)
|
||||
}
|
||||
|
||||
public static func setAutoInstall(_ value: Bool, defaults: UserDefaults = .standard) {
|
||||
defaults.set(value, forKey: autoInstallKey)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,165 @@
|
||||
import CoreGraphics
|
||||
import Foundation
|
||||
import ShotdeckCore
|
||||
import Testing
|
||||
|
||||
// Which window a capture takes, for each scope — pure logic over the window list the
|
||||
// window server reports, so it is testable without a display session.
|
||||
|
||||
private func window(
|
||||
id: UInt32,
|
||||
bundle: String?,
|
||||
pid: Int32 = 100,
|
||||
frame: CGRect = CGRect(x: 100, y: 100, width: 800, height: 600),
|
||||
layer: Int = 0
|
||||
) -> WindowCandidate {
|
||||
WindowCandidate(
|
||||
windowID: id, ownerBundleID: bundle, ownerPID: pid, frame: frame, layer: layer)
|
||||
}
|
||||
|
||||
@Test
|
||||
func windowScopeTakesTheFrontWindowOfTheFrontApp() throws {
|
||||
let candidates = [
|
||||
window(id: 1, bundle: "com.apple.Safari", pid: 10),
|
||||
window(id: 2, bundle: "com.apple.Terminal", pid: 20),
|
||||
]
|
||||
let target = try CaptureTargetResolver.resolve(
|
||||
scope: .window, savedArea: nil, frontmostPID: 20, candidates: candidates)
|
||||
guard case .window(let id, _, _) = target else {
|
||||
Issue.record("expected a window target, got \(target)")
|
||||
return
|
||||
}
|
||||
#expect(id == 2)
|
||||
}
|
||||
|
||||
@Test
|
||||
func windowScopeFallsBackToTheFrontmostWindowOfAnyApp() throws {
|
||||
let candidates = [
|
||||
window(id: 1, bundle: "com.apple.Safari", pid: 10),
|
||||
window(id: 2, bundle: "com.apple.Terminal", pid: 20),
|
||||
]
|
||||
let target = try CaptureTargetResolver.resolve(
|
||||
scope: .window, savedArea: nil, frontmostPID: 99, candidates: candidates)
|
||||
guard case .window(let id, _, _) = target else {
|
||||
Issue.record("expected a window target, got \(target)")
|
||||
return
|
||||
}
|
||||
#expect(id == 1)
|
||||
}
|
||||
|
||||
@Test
|
||||
func redlineNeverCapturesItself() throws {
|
||||
let candidates = [
|
||||
window(id: 1, bundle: CaptureTargetResolver.ownBundleID, pid: 5),
|
||||
window(id: 2, bundle: "com.apple.Safari", pid: 10),
|
||||
]
|
||||
let target = try CaptureTargetResolver.resolve(
|
||||
scope: .window, savedArea: nil, frontmostPID: 5, candidates: candidates)
|
||||
guard case .window(let id, _, _) = target else {
|
||||
Issue.record("expected a window target, got \(target)")
|
||||
return
|
||||
}
|
||||
#expect(id == 2)
|
||||
}
|
||||
|
||||
@Test
|
||||
func chromeAndDesktopWindowsAreNotCandidates() throws {
|
||||
let candidates = [
|
||||
window(id: 1, bundle: "com.apple.dock", layer: 20),
|
||||
window(id: 2, bundle: "com.apple.WindowManager", layer: 8),
|
||||
window(id: 3, bundle: "com.apple.Safari"),
|
||||
]
|
||||
let target = try CaptureTargetResolver.resolve(
|
||||
scope: .window, savedArea: nil, frontmostPID: 0, candidates: candidates)
|
||||
guard case .window(let id, _, _) = target else {
|
||||
Issue.record("expected a window target, got \(target)")
|
||||
return
|
||||
}
|
||||
#expect(id == 3)
|
||||
}
|
||||
|
||||
@Test
|
||||
func tinyWindowsAreIgnored() throws {
|
||||
let candidates = [
|
||||
window(id: 1, bundle: "com.apple.Safari", frame: CGRect(x: 0, y: 0, width: 20, height: 20)),
|
||||
window(id: 2, bundle: "com.apple.Terminal"),
|
||||
]
|
||||
let target = try CaptureTargetResolver.resolve(
|
||||
scope: .window, savedArea: nil, frontmostPID: 0, candidates: candidates)
|
||||
guard case .window(let id, _, _) = target else {
|
||||
Issue.record("expected a window target, got \(target)")
|
||||
return
|
||||
}
|
||||
#expect(id == 2)
|
||||
}
|
||||
|
||||
@Test
|
||||
func browserScopeTakesTheFrontBrowserWindow() throws {
|
||||
let candidates = [
|
||||
window(id: 1, bundle: "com.apple.Terminal", pid: 10),
|
||||
window(id: 2, bundle: "com.google.Chrome", pid: 11),
|
||||
window(id: 3, bundle: "com.apple.Safari", pid: 12),
|
||||
]
|
||||
let target = try CaptureTargetResolver.resolve(
|
||||
scope: .browser, savedArea: nil, frontmostPID: 10, candidates: candidates)
|
||||
guard case .window(let id, _, _) = target else {
|
||||
Issue.record("expected a window target, got \(target)")
|
||||
return
|
||||
}
|
||||
#expect(id == 2)
|
||||
}
|
||||
|
||||
@Test
|
||||
func browserScopeSaysSoWhenNoBrowserIsOpen() {
|
||||
let candidates = [window(id: 1, bundle: "com.apple.Terminal")]
|
||||
#expect(throws: ShotdeckError.self) {
|
||||
_ = try CaptureTargetResolver.resolve(
|
||||
scope: .browser, savedArea: nil, frontmostPID: 10, candidates: candidates)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
func windowScopeSaysSoWhenThereIsNoWindow() {
|
||||
#expect(throws: ShotdeckError.self) {
|
||||
_ = try CaptureTargetResolver.resolve(
|
||||
scope: .window, savedArea: nil, frontmostPID: 10,
|
||||
candidates: [window(id: 1, bundle: "com.apple.dock", layer: 20)])
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
func areaScopeUsesTheSavedAreaAndSaysWhenThereIsNone() throws {
|
||||
let area = CaptureRegion(
|
||||
displayID: CGMainDisplayID(), rect: CGRect(x: 10, y: 20, width: 300, height: 200),
|
||||
capturedScale: 2)
|
||||
let target = try CaptureTargetResolver.resolve(
|
||||
scope: .area, savedArea: area, frontmostPID: 0, candidates: [])
|
||||
#expect(target == .region(area))
|
||||
|
||||
#expect(throws: ShotdeckError.self) {
|
||||
_ = try CaptureTargetResolver.resolve(
|
||||
scope: .area, savedArea: nil, frontmostPID: 0, candidates: [])
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
func screenScopeUsesTheAreaDisplay() throws {
|
||||
let area = CaptureRegion(
|
||||
displayID: CGMainDisplayID(), rect: CGRect(x: 10, y: 20, width: 300, height: 200),
|
||||
capturedScale: 2)
|
||||
let target = try CaptureTargetResolver.resolve(
|
||||
scope: .screen, savedArea: area, frontmostPID: 0, candidates: [])
|
||||
#expect(target == .display(displayID: area.displayID))
|
||||
}
|
||||
|
||||
@Test
|
||||
func captureScopeDescriptionsNameWhatWillBeTaken() {
|
||||
let area = CaptureRegion(
|
||||
displayID: CGMainDisplayID(), rect: CGRect(x: 0, y: 0, width: 800, height: 600),
|
||||
capturedScale: 2)
|
||||
#expect(CaptureScope.area.targetDescription(savedArea: area).contains("800 × 600"))
|
||||
#expect(CaptureScope.area.targetDescription(savedArea: nil).contains("No area"))
|
||||
#expect(CaptureScope.window.targetDescription(savedArea: area).contains("frontmost window"))
|
||||
#expect(CaptureScope.browser.targetDescription(savedArea: area).contains("browser"))
|
||||
#expect(CaptureScope.screen.targetDescription(savedArea: area).contains("Display"))
|
||||
}
|
||||
@@ -0,0 +1,343 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Redline UX v2</title>
|
||||
<meta name="description" content="Redline v2: capture decision first, one Settings entry point, capture scopes (area, window, browser, screen), automatic updates, no filler text. Light and dark at 1:1.">
|
||||
<style>
|
||||
:root{--page:#e9e7e2;--ink:#1d1d1f;--mut:rgba(0,0,0,.56);--rule:rgba(0,0,0,.12);--acc:#0a64d6}
|
||||
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]){--page:#141416;--ink:#ececec;--mut:rgba(255,255,255,.6);--rule:rgba(255,255,255,.12);--acc:#5ea3ff}}
|
||||
:root[data-theme="dark"]{--page:#141416;--ink:#ececec;--mut:rgba(255,255,255,.6);--rule:rgba(255,255,255,.12);--acc:#5ea3ff}
|
||||
body{margin:0;background:var(--page);color:var(--ink);font:13px/1.45 -apple-system,BlinkMacSystemFont,"SF Pro Text","Helvetica Neue",sans-serif;-webkit-font-smoothing:antialiased}
|
||||
header.board{padding:32px 40px 6px;max-width:1180px}
|
||||
header.board h1{margin:0 0 6px;font-size:22px;font-weight:600}
|
||||
header.board p{margin:0;color:var(--mut);max-width:780px}
|
||||
section.turn{padding:26px 40px 34px;border-top:1px solid var(--rule)}
|
||||
.thd{display:flex;gap:10px;align-items:baseline;margin:0 0 16px;flex-wrap:wrap}
|
||||
.tid{font:600 10px ui-monospace,Menlo,monospace;padding:3px 7px;background:var(--ink);color:var(--page)}
|
||||
.tname{font-weight:600}.tnote{color:var(--mut);font-size:12px}
|
||||
.row{display:flex;flex-wrap:wrap;gap:32px;align-items:flex-start}
|
||||
.opt{display:flex;flex-direction:column;gap:8px;max-width:100%}
|
||||
.olabel{font-size:12px;color:var(--mut)}
|
||||
.notes{margin:12px 0 0;padding-left:18px;color:var(--mut);max-width:560px;font-size:12.5px}
|
||||
.notes li{margin:3px 0}
|
||||
.scroller{max-width:100%;overflow-x:auto;padding:2px 2px 14px}
|
||||
@media (max-width:600px){header.board,section.turn{padding-left:16px;padding-right:16px}}
|
||||
|
||||
/* macOS tokens per mock */
|
||||
.mac{--win:#ececec;--content:#fff;--side:#e8e8e8;--label:rgba(0,0,0,.88);--label2:rgba(0,0,0,.62);--label3:rgba(0,0,0,.5);--sep:rgba(0,0,0,.1);
|
||||
--ctl:#fff;--ctlB:rgba(0,0,0,.16);--fill:rgba(0,0,0,.05);--fill2:rgba(0,0,0,.09);--accent:#0a64d6;--accentText:#fff;--seg:#e3e3e3;--segOn:#fff;
|
||||
--pop:rgba(246,246,246,.97);--group:#fff;--groupB:rgba(0,0,0,.08);--orange:#c45a00;--green:#248a3d;--tA:#d9ded9;--tB:#c9d3e1;--tC:#e3d6cc;
|
||||
--shadow:0 0 0 .5px rgba(0,0,0,.22),0 18px 48px rgba(0,0,0,.22),0 4px 10px rgba(0,0,0,.08);
|
||||
color:var(--label);font:13px/1.35 -apple-system,BlinkMacSystemFont,"SF Pro Text","Helvetica Neue",sans-serif;letter-spacing:-.003em}
|
||||
.mac.dark{--win:#2a2a2c;--content:#1e1e1e;--side:#2b2a2e;--label:rgba(255,255,255,.88);--label2:rgba(255,255,255,.66);--label3:rgba(255,255,255,.5);--sep:rgba(255,255,255,.1);
|
||||
--ctl:#5c5c60;--ctlB:rgba(255,255,255,.08);--fill:rgba(255,255,255,.06);--fill2:rgba(255,255,255,.11);--accent:#0a7cff;--seg:#3a3a3c;--segOn:#6a6a6e;
|
||||
--pop:rgba(40,40,42,.97);--group:#2c2c2e;--groupB:rgba(255,255,255,.07);--orange:#ff9f0a;--green:#32d74b;--tA:#3b423d;--tB:#3a4352;--tC:#4b4036;
|
||||
--shadow:0 0 0 .5px rgba(255,255,255,.12),0 18px 48px rgba(0,0,0,.6)}
|
||||
.desk{background:linear-gradient(#cfd6de,#bcc6d0);padding:0 14px 22px;border-radius:2px}
|
||||
.desk.dark{background:linear-gradient(#22262c,#191b1f)}
|
||||
.mbar{height:24px;display:flex;justify-content:flex-end;align-items:center;gap:12px;font-size:13px;color:rgba(0,0,0,.85);padding:0 4px}
|
||||
.desk.dark .mbar{color:rgba(255,255,255,.85)}
|
||||
.mbar .icon{display:inline-flex;align-items:center;gap:3px;padding:1px 6px;border-radius:4px;background:rgba(0,0,0,.14);font-weight:600;font-size:12px}
|
||||
.desk.dark .mbar .icon{background:rgba(255,255,255,.18)}
|
||||
.pop{width:340px;background:var(--pop);border-radius:12px;box-shadow:var(--shadow);margin-left:auto;padding:10px;display:flex;flex-direction:column;gap:9px;backdrop-filter:blur(20px)}
|
||||
.hrow{display:flex;align-items:center;gap:6px}
|
||||
.sp{flex:1}
|
||||
.tt{font-weight:600;font-size:13px}
|
||||
.t2{color:var(--label2);font-size:11px}
|
||||
.t3{color:var(--label3);font-size:11px}
|
||||
.badge{font-size:11px;color:var(--label2);background:var(--fill2);border-radius:9px;padding:1px 7px}
|
||||
.ib{width:22px;height:22px;border-radius:5px;display:inline-flex;align-items:center;justify-content:center;color:var(--label2)}
|
||||
.ib:hover{background:var(--fill2)}
|
||||
.ib svg,.btn svg,.seg svg,.mi svg{width:14px;height:14px;stroke:currentColor;fill:none;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
|
||||
.btn{display:inline-flex;align-items:center;justify-content:center;gap:5px;height:24px;padding:0 10px;border-radius:6px;background:var(--ctl);border:.5px solid var(--ctlB);box-shadow:0 .5px 1px rgba(0,0,0,.12);font-size:12.5px;color:var(--label);white-space:nowrap}
|
||||
.btn.p{background:var(--accent);color:var(--accentText);border-color:transparent}
|
||||
.btn.dis{opacity:.55}
|
||||
.btn.w{flex:1}
|
||||
.btn kbd{font:11px -apple-system;color:inherit;opacity:.6}
|
||||
.btn.big{height:28px}
|
||||
.seg{display:flex;background:var(--seg);border-radius:7px;padding:2px;gap:2px}
|
||||
.seg span{flex:1;display:flex;align-items:center;justify-content:center;gap:4px;height:22px;border-radius:5px;font-size:11.5px;color:var(--label)}
|
||||
.seg span.on{background:var(--segOn);box-shadow:0 .5px 1.5px rgba(0,0,0,.2);font-weight:600}
|
||||
.capbox{background:var(--fill);border-radius:8px;padding:8px;display:flex;flex-direction:column;gap:7px}
|
||||
.tgt{display:flex;align-items:center;gap:6px;font-size:11.5px;color:var(--label2)}
|
||||
.tgt b{color:var(--label);font-weight:500}
|
||||
.lnk{color:var(--accent);font-size:11.5px}
|
||||
.thumbs{display:flex;gap:6px}
|
||||
.th{flex:1;height:58px;border-radius:4px;position:relative;border:.5px solid var(--sep)}
|
||||
.th i{position:absolute;left:3px;top:3px;font:700 9px -apple-system;color:#fff;background:rgba(0,0,0,.65);padding:1px 4px;border-radius:2px;font-style:normal}
|
||||
.th.a{background:var(--tA)}.th.b{background:var(--tB)}.th.c{background:var(--tC)}
|
||||
.th.more{display:flex;align-items:center;justify-content:center;flex:0 0 46px;background:var(--fill);font-size:11px;color:var(--label2);font-weight:600}
|
||||
.empty{height:58px;border-radius:6px;background:var(--fill);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:1px}
|
||||
.status{font-size:11.5px;display:flex;gap:6px;align-items:center}
|
||||
.dot{width:7px;height:7px;border-radius:50%;background:var(--orange)}
|
||||
.dot.g{background:var(--green)}
|
||||
.sep{height:1px;background:var(--sep);margin:0 -10px}
|
||||
.menu{background:var(--pop);border-radius:8px;box-shadow:var(--shadow);padding:5px;width:236px;font-size:13px}
|
||||
.mi{display:flex;align-items:center;gap:8px;padding:4px 8px;border-radius:5px;color:var(--label)}
|
||||
.mi.on{background:var(--accent);color:#fff}
|
||||
.mi.on .t3,.mi.on kbd{color:rgba(255,255,255,.8)}
|
||||
.mi kbd{margin-left:auto;font:12px -apple-system;color:var(--label3)}
|
||||
.mi .chk{width:12px;text-align:center}
|
||||
.msep{height:1px;background:var(--sep);margin:4px 6px}
|
||||
.mhead{font-size:11px;color:var(--label3);padding:3px 8px;font-weight:600}
|
||||
/* window */
|
||||
.win{border-radius:10px;box-shadow:var(--shadow);overflow:hidden;background:var(--content);width:880px}
|
||||
.tb{display:flex;align-items:center;gap:8px;height:52px;padding:0 12px;background:var(--win);border-bottom:.5px solid var(--sep)}
|
||||
.lights{display:flex;gap:8px;margin-right:6px}.lights i{width:12px;height:12px;border-radius:50%;background:#ff5f57}.lights i:nth-child(2){background:#febc2e}.lights i:nth-child(3){background:#28c840}
|
||||
.wbody{display:flex;height:150px}
|
||||
.side{width:200px;background:var(--side);border-right:.5px solid var(--sep);padding:8px;font-size:12px}
|
||||
.srow{padding:5px 7px;border-radius:6px}.srow.on{background:var(--fill2)}
|
||||
.main{flex:1;padding:12px 14px;display:flex;gap:10px}
|
||||
/* settings */
|
||||
.sw{width:460px;border-radius:10px;box-shadow:var(--shadow);overflow:hidden;background:var(--win)}
|
||||
.stb{height:28px;display:flex;align-items:center;justify-content:center;font-weight:600;font-size:13px;position:relative;color:var(--label)}
|
||||
.stb .lights{position:absolute;left:10px}
|
||||
.sbody{padding:4px 18px 16px}
|
||||
.sh{font-size:12px;font-weight:600;color:var(--label2);margin:12px 4px 5px}
|
||||
.grp{background:var(--group);border:.5px solid var(--groupB);border-radius:8px}
|
||||
.sr{display:flex;align-items:center;gap:8px;padding:7px 10px;min-height:22px;border-top:.5px solid var(--sep)}
|
||||
.sr:first-child{border-top:none}
|
||||
.sr .k{flex:1}
|
||||
.sr .v{color:var(--label2);font-size:12px}
|
||||
.pop2{display:inline-flex;align-items:center;gap:6px;height:22px;padding:0 6px 0 9px;border-radius:5px;background:var(--ctl);border:.5px solid var(--ctlB);font-size:12px}
|
||||
.pop2 i{width:14px;height:16px;border-radius:4px;background:var(--accent);display:inline-block}
|
||||
.sw2{width:30px;height:18px;border-radius:9px;background:var(--accent);position:relative}
|
||||
.sw2::after{content:"";position:absolute;right:2px;top:2px;width:14px;height:14px;border-radius:50%;background:#fff}
|
||||
.sw2.off{background:var(--fill2)}.sw2.off::after{left:2px;right:auto}
|
||||
.cap{font-size:11px;color:var(--label3);margin:6px 4px 0;line-height:1.4}
|
||||
.sfoot{display:flex;justify-content:space-between;align-items:center;margin-top:14px}
|
||||
.spec{max-width:1060px}
|
||||
.spec h2.sh2{font-size:14px;margin:18px 0 6px}
|
||||
.spec table{border-collapse:collapse;width:100%;font-size:12.5px}
|
||||
.spec td,.spec th{border-bottom:1px solid var(--rule);padding:6px 8px;text-align:left;vertical-align:top}
|
||||
.spec th{color:var(--mut);font-weight:600}
|
||||
.spec code{font:12px ui-monospace,Menlo,monospace}
|
||||
.spec p{max-width:820px}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<header class="board">
|
||||
<h1>Redline v2 — decide what you capture first</h1>
|
||||
<p>The popover now starts with the capture decision (what, and where), then the pages, then the two verbs. Settings has one visible door: the gear in the popover header. Filler lines are gone; a status line appears only when something happened. Updates install themselves.</p>
|
||||
</header>
|
||||
|
||||
<svg width="0" height="0" style="position:absolute">
|
||||
<symbol id="gear" viewBox="0 0 16 16"><circle cx="8" cy="8" r="2.3"/><path d="M8 1.5v2M8 12.5v2M1.5 8h2M12.5 8h2M3.4 3.4l1.4 1.4M11.2 11.2l1.4 1.4M3.4 12.6l1.4-1.4M11.2 4.8l1.4-1.4"/></symbol>
|
||||
<symbol id="area" viewBox="0 0 16 16"><path d="M2 5V2h3M11 2h3v3M14 11v3h-3M5 14H2v-3"/></symbol>
|
||||
<symbol id="window" viewBox="0 0 16 16"><rect x="2" y="3" width="12" height="10" rx="1.5"/><path d="M2 6h12"/></symbol>
|
||||
<symbol id="browser" viewBox="0 0 16 16"><rect x="2" y="3" width="12" height="10" rx="1.5"/><path d="M2 6h12M4.5 4.5h.01M6.5 4.5h.01"/></symbol>
|
||||
<symbol id="screen" viewBox="0 0 16 16"><rect x="1.5" y="2.5" width="13" height="9" rx="1"/><path d="M6 14h4M8 11.5V14"/></symbol>
|
||||
<symbol id="send" viewBox="0 0 16 16"><path d="M14 2 7 9M14 2l-4.5 12L7 9 2 6.5z"/></symbol>
|
||||
<symbol id="plus" viewBox="0 0 16 16"><path d="M8 3v10M3 8h10"/></symbol>
|
||||
<symbol id="chev" viewBox="0 0 16 16"><path d="m5 6 3 3 3-3"/></symbol>
|
||||
<symbol id="win2" viewBox="0 0 16 16"><rect x="2" y="2.5" width="12" height="11" rx="1.5"/><path d="M6 2.5v11"/></symbol>
|
||||
</svg>
|
||||
|
||||
<!-- ===================== 1 POPOVER ===================== -->
|
||||
<section class="turn" id="t1">
|
||||
<div class="thd"><a class="tid" href="#t1">1</a><span class="tname">Menu-bar popover</span><span class="tnote">340 pt · controlSize small · capture decision → pages → verbs</span></div>
|
||||
<div class="scroller"><div class="row">
|
||||
|
||||
<div class="opt"><div class="olabel">1a · Idle, empty session · light</div>
|
||||
<div class="desk"><div class="mbar"><span class="icon">◫</span><span>Sat 31 Oct 13:05</span></div>
|
||||
<div class="mac pop" role="dialog" aria-label="Redline">
|
||||
<div class="hrow"><div><div class="tt">DEV03 · v1.4.2 (41)</div><div class="t2">a1b2c3d4 · Ben Hippler</div></div><span class="sp"></span>
|
||||
<span class="ib" title="Edit review details" aria-label="Edit review details"><svg><use href="#win2"/></svg></span>
|
||||
<span class="ib" title="Settings (⌘,)" aria-label="Settings"><svg><use href="#gear"/></svg></span></div>
|
||||
<div class="capbox">
|
||||
<div class="seg" role="radiogroup" aria-label="Capture"><span class="on"><svg><use href="#area"/></svg>Area</span><span><svg><use href="#window"/></svg>Window</span><span><svg><use href="#browser"/></svg>Browser</span><span><svg><use href="#screen"/></svg>Screen</span></div>
|
||||
<div class="tgt"><b>800 × 600</b> on Display 1<span class="sp"></span><span class="lnk">Choose Area…</span></div>
|
||||
</div>
|
||||
<div class="empty"><div style="font-size:12px;color:var(--label2)">No pages yet</div><div class="t3">⌥⇧2 captures the area</div></div>
|
||||
<div class="hrow"><span class="btn w big"><svg><use href="#area"/></svg>Capture <kbd>⌥⇧2</kbd></span><span class="btn w big p dis"><svg><use href="#send"/></svg>Send</span></div>
|
||||
<div class="hrow"><span class="btn w dis"><svg><use href="#plus"/></svg>New Session…</span><span class="btn w"><svg><use href="#win2"/></svg>Open Redline</span></div>
|
||||
</div></div>
|
||||
<ul class="notes"><li>Header has exactly two icons: details (opens the window on Lane) and <b>Settings</b>. No “…” menu.</li><li>The capture box is the first decision on screen; Choose Area… is always one click away.</li><li>No footer. Nothing is printed unless it is news.</li></ul>
|
||||
</div>
|
||||
|
||||
<div class="opt"><div class="olabel">1b · Pages present + one return · dark</div>
|
||||
<div class="desk dark"><div class="mbar"><span class="icon">◫ 3</span><span>Sat 31 Oct 13:05</span></div>
|
||||
<div class="mac dark pop" role="dialog" aria-label="Redline">
|
||||
<div class="hrow"><div><div class="tt">DEV03 · v1.4.2 (41)</div><div class="t2">a1b2c3d4 · Ben Hippler · 3 pages</div></div><span class="sp"></span>
|
||||
<span class="ib" aria-label="Edit review details"><svg><use href="#win2"/></svg></span><span class="ib" aria-label="Settings"><svg><use href="#gear"/></svg></span></div>
|
||||
<div class="capbox">
|
||||
<div class="seg"><span><svg><use href="#area"/></svg>Area</span><span class="on"><svg><use href="#window"/></svg>Window</span><span><svg><use href="#browser"/></svg>Browser</span><span><svg><use href="#screen"/></svg>Screen</span></div>
|
||||
<div class="tgt">Front window when you press ⌥⇧2<span class="sp"></span><span class="t3">area kept: 800 × 600</span></div>
|
||||
</div>
|
||||
<div class="thumbs"><div class="th a"><i>1</i></div><div class="th b"><i>2</i></div><div class="th c"><i>3</i></div></div>
|
||||
<div class="status"><span class="dot"></span>OMS test lane came back · 2 pages marked<span class="sp"></span><span class="lnk">Open</span></div>
|
||||
<div class="hrow"><span class="btn w big"><svg><use href="#window"/></svg>Capture <kbd>⌥⇧2</kbd></span><span class="btn w big p"><svg><use href="#send"/></svg>Send 3 pages</span></div>
|
||||
<div class="hrow"><span class="btn w"><svg><use href="#plus"/></svg>New Session…</span><span class="btn w"><svg><use href="#win2"/></svg>Open Redline</span></div>
|
||||
</div></div>
|
||||
<ul class="notes"><li>The Capture button wears the scope icon, so what ⌥⇧2 will grab is never ambiguous.</li><li>Choosing a non-area scope keeps the saved area (“area kept”) — switching back to Area restores it.</li></ul>
|
||||
</div>
|
||||
|
||||
<div class="opt"><div class="olabel">1c · New Session… — the capture decision at the moment of starting · light</div>
|
||||
<div class="desk"><div class="mbar"><span class="icon">◫ 3</span><span>Sat 31 Oct 13:06</span></div>
|
||||
<div class="mac pop" role="dialog" aria-label="Start a new session">
|
||||
<div class="hrow"><div><div class="tt">New session</div><div class="t2">The current 3 pages are kept as a past session.</div></div></div>
|
||||
<div class="capbox">
|
||||
<div class="t2" style="font-weight:600;color:var(--label)">Capture</div>
|
||||
<div class="seg"><span class="on"><svg><use href="#area"/></svg>Area</span><span><svg><use href="#window"/></svg>Window</span><span><svg><use href="#browser"/></svg>Browser</span><span><svg><use href="#screen"/></svg>Screen</span></div>
|
||||
<div class="tgt"><b>800 × 600</b> on Display 1<span class="sp"></span><span class="lnk">Choose Area…</span></div>
|
||||
</div>
|
||||
<div class="capbox">
|
||||
<div class="t2" style="font-weight:600;color:var(--label)">Review details</div>
|
||||
<div class="tgt">DEV03 · v1.4.2 (41) · a1b2c3d4 · Ben Hippler<span class="sp"></span><span class="lnk">Edit…</span></div>
|
||||
</div>
|
||||
<div class="hrow"><span class="sp"></span><span class="btn">Cancel</span><span class="btn p">Start Session</span></div>
|
||||
</div></div>
|
||||
<ul class="notes"><li>New Session… never starts silently: it shows scope, area and inherited details in place of the pages, with Start Session as the default button (Return).</li><li>Choose Area… here dismisses the popover, runs the picker, and comes back to this step with the new size.</li></ul>
|
||||
</div>
|
||||
|
||||
<div class="opt"><div class="olabel">1d · Capture-scope menu from the keyboard (⌥⇧1) · dark</div>
|
||||
<div class="desk dark" style="padding-bottom:30px"><div class="mbar"><span class="icon">◫</span><span>Sat 31 Oct 13:06</span></div>
|
||||
<div class="mac dark menu" role="menu" aria-label="Capture" style="margin-left:auto">
|
||||
<div class="mhead">Capture</div>
|
||||
<div class="mi"><span class="chk">✓</span><svg><use href="#area"/></svg>Saved Area <span class="t3">800 × 600</span><kbd>1</kbd></div>
|
||||
<div class="mi on"><span class="chk"></span><svg><use href="#window"/></svg>Front Window<kbd>2</kbd></div>
|
||||
<div class="mi"><span class="chk"></span><svg><use href="#browser"/></svg>Browser Page<kbd>3</kbd></div>
|
||||
<div class="mi"><span class="chk"></span><svg><use href="#screen"/></svg>Whole Screen<kbd>4</kbd></div>
|
||||
<div class="msep"></div>
|
||||
<div class="mi"><span class="chk"></span><svg><use href="#area"/></svg>Choose New Area…<kbd>A</kbd></div>
|
||||
</div></div>
|
||||
<ul class="notes"><li>⌥⇧1 opens this menu where the pointer is; one keystroke captures with that scope and makes it the session’s scope.</li><li>Browser Page grabs the front browser window’s page area (Safari, Chrome, Arc, Edge); the tab strip and toolbar are cropped.</li></ul>
|
||||
</div>
|
||||
|
||||
<div class="opt"><div class="olabel">1e · Update installed in the background · light</div>
|
||||
<div class="desk"><div class="mbar"><span class="icon">◫</span><span>Sat 31 Oct 13:07</span></div>
|
||||
<div class="mac pop">
|
||||
<div class="hrow"><div><div class="tt">DEV03 · v1.4.2 (41)</div><div class="t2">a1b2c3d4 · Ben Hippler</div></div><span class="sp"></span><span class="ib"><svg><use href="#win2"/></svg></span><span class="ib"><svg><use href="#gear"/></svg></span></div>
|
||||
<div class="status"><span class="dot g"></span>Redline 0.6.0 is ready — restarts after you send<span class="sp"></span><span class="lnk">Restart Now</span></div>
|
||||
<div class="hrow"><span class="btn w big"><svg><use href="#area"/></svg>Capture <kbd>⌥⇧2</kbd></span><span class="btn w big p"><svg><use href="#send"/></svg>Send 2 pages</span></div>
|
||||
</div></div>
|
||||
<ul class="notes"><li>One line, only while it matters. It never interrupts a session with unsent pages.</li><li>Cropped to the relevant part for this mock.</li></ul>
|
||||
</div>
|
||||
|
||||
</div></div>
|
||||
</section>
|
||||
|
||||
<!-- ===================== 2 WINDOW HEADER ===================== -->
|
||||
<section class="turn" id="t2">
|
||||
<div class="thd"><a class="tid" href="#t2">2</a><span class="tname">Redline window · header</span><span class="tnote">scope and area are part of the session, shown where the verbs are</span></div>
|
||||
<div class="scroller"><div class="row">
|
||||
<div class="opt"><div class="olabel">2a · Current session · light</div>
|
||||
<div class="mac win">
|
||||
<div class="tb"><div class="lights"><i></i><i></i><i></i></div>
|
||||
<div><div class="tt" style="font-size:14px">DEV03 <span class="badge">Current</span></div><div class="t2">3 pages · not sent</div></div><span class="sp"></span>
|
||||
<span class="pop2" aria-label="Capture scope"><svg style="width:13px;height:13px;stroke:currentColor;fill:none;stroke-width:1.6"><use href="#area"/></svg>Area · 800 × 600<i></i></span>
|
||||
<span class="btn">Choose Area…</span>
|
||||
<span class="btn"><svg><use href="#area"/></svg>Capture</span>
|
||||
<span class="btn"><svg><use href="#plus"/></svg>New Session…</span>
|
||||
<span class="btn p"><svg><use href="#send"/></svg>Send 3 pages</span>
|
||||
</div>
|
||||
<div class="wbody"><div class="side"><div class="t3" style="margin:2px 6px 6px">Today</div><div class="srow on"><b>DEV03</b> <span class="t3">13:05</span><div class="t3">3 pages · not sent</div></div><div class="srow">OMS test lane <span class="t3">11:48</span><div class="t3" style="color:var(--orange)">2 pages marked</div></div></div>
|
||||
<div class="main"><div class="th a" style="height:96px"><i>1</i></div><div class="th b" style="height:96px"><i>2</i></div><div class="th c" style="height:96px"><i>3</i></div></div></div>
|
||||
</div>
|
||||
<ul class="notes"><li>No gear here: Settings is ⌘, (and the popover gear) — one surface, one door.</li><li>Cropped to the header and a slice of the content for this mock.</li></ul>
|
||||
</div>
|
||||
<div class="opt"><div class="olabel">2b · Same, dark, Browser scope</div>
|
||||
<div class="mac dark win" style="width:880px">
|
||||
<div class="tb"><div class="lights"><i></i><i></i><i></i></div>
|
||||
<div><div class="tt" style="font-size:14px">DEV03 <span class="badge">Current</span></div><div class="t2">3 pages · not sent</div></div><span class="sp"></span>
|
||||
<span class="pop2"><svg style="width:13px;height:13px;stroke:currentColor;fill:none;stroke-width:1.6"><use href="#browser"/></svg>Browser Page<i></i></span>
|
||||
<span class="btn"><svg><use href="#browser"/></svg>Capture</span>
|
||||
<span class="btn"><svg><use href="#plus"/></svg>New Session…</span>
|
||||
<span class="btn p"><svg><use href="#send"/></svg>Send 3 pages</span>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="notes"><li>With a non-area scope, Choose Area… disappears from the header; it lives in the scope menu as “Choose New Area…”.</li></ul>
|
||||
</div>
|
||||
</div></div>
|
||||
</section>
|
||||
|
||||
<!-- ===================== 3 SETTINGS ===================== -->
|
||||
<section class="turn" id="t3">
|
||||
<div class="thd"><a class="tid" href="#t3">3</a><span class="tname">Settings</span><span class="tnote">460 pt · one window, reached only from the popover gear or ⌘,</span></div>
|
||||
<div class="scroller"><div class="row">
|
||||
<div class="opt"><div class="olabel">3a · light</div>
|
||||
<div class="mac sw">
|
||||
<div class="stb"><div class="lights"><i></i><i></i><i></i></div>Redline Settings</div>
|
||||
<div class="sbody">
|
||||
<div class="sh">Capture</div>
|
||||
<div class="grp">
|
||||
<div class="sr"><span class="k">Capture</span><span class="pop2">Saved Area<i></i></span></div>
|
||||
<div class="sr"><span class="k">Saved area</span><span class="v">800 × 600 on Display 1</span><span class="btn">Choose…</span></div>
|
||||
<div class="sr"><span class="k">Capture shortcut</span><span class="btn">⌥⇧2</span></div>
|
||||
<div class="sr"><span class="k">Capture menu shortcut</span><span class="btn">⌥⇧1</span></div>
|
||||
<div class="sr"><span class="k">Ask what to capture on New Session</span><span class="sw2"></span></div>
|
||||
</div>
|
||||
<div class="sh">Sending</div>
|
||||
<div class="grp">
|
||||
<div class="sr"><span class="k">Send with</span><span class="seg" style="width:190px"><span class="on">AirDrop</span><span>OneDrive</span></span></div>
|
||||
<div class="sr"><span class="k">Save PDFs to</span><span class="v">~/Desktop</span><span class="btn">Choose…</span></div>
|
||||
<div class="sr"><span class="k">Watch for returns in</span><span class="v">~/Downloads</span><span class="btn">Choose…</span></div>
|
||||
</div>
|
||||
<div class="sh">Sessions</div>
|
||||
<div class="grp">
|
||||
<div class="sr"><span class="k">Delete sessions older than</span><span class="pop2">Never<i></i></span></div>
|
||||
<div class="sr"><span class="k">20 sessions on this Mac</span><span class="btn dis">Clean Up Now…</span></div>
|
||||
</div>
|
||||
<div class="cap">Deleting removes Redline’s own screenshots only. PDFs you sent stay where they are.</div>
|
||||
<div class="sh">Updates</div>
|
||||
<div class="grp">
|
||||
<div class="sr"><span class="k">Install updates automatically</span><span class="sw2"></span></div>
|
||||
<div class="sr"><span class="k">Version 0.5.0 · checked 13:02</span><span class="btn">Check Now</span></div>
|
||||
</div>
|
||||
<div class="cap">Updates download in the background and install the next time Redline has no unsent pages. Your area, shortcuts and sessions are kept.</div>
|
||||
<div class="sfoot"><span class="t3">Redline 0.5.0</span><span class="btn">Quit Redline</span></div>
|
||||
</div>
|
||||
</div></div>
|
||||
<div class="opt"><div class="olabel">3b · dark · update ready</div>
|
||||
<div class="mac dark sw">
|
||||
<div class="stb"><div class="lights"><i></i><i></i><i></i></div>Redline Settings</div>
|
||||
<div class="sbody">
|
||||
<div class="sh">Updates</div>
|
||||
<div class="grp">
|
||||
<div class="sr"><span class="k">Install updates automatically</span><span class="sw2"></span></div>
|
||||
<div class="sr"><span class="k">0.6.0 downloaded · installs after your next send</span><span class="btn p">Restart Now</span></div>
|
||||
</div>
|
||||
<div class="cap">Turned off: Redline still checks every 6 hours and shows “Update to 0.6.0” here and in the popover, but waits for you.</div>
|
||||
<div class="sh">Capture</div>
|
||||
<div class="grp">
|
||||
<div class="sr"><span class="k">Capture</span><span class="pop2">Front Window<i></i></span></div>
|
||||
<div class="sr"><span class="k">Saved area</span><span class="v">800 × 600 on Display 1</span><span class="btn">Choose…</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<ul class="notes"><li>Quit lives here (and ⌘Q in the popover): the popover has no menu left to hide it in.</li><li>3b is cropped to the changed groups.</li></ul>
|
||||
</div>
|
||||
</div></div>
|
||||
</section>
|
||||
|
||||
<!-- ===================== SPEC ===================== -->
|
||||
<section class="turn" id="t4">
|
||||
<div class="thd"><a class="tid" href="#t4">4</a><span class="tname">Labels, keys, states</span></div>
|
||||
<div class="spec">
|
||||
<h2 class="sh2">Strings</h2>
|
||||
<table>
|
||||
<tr><th>Place</th><th>Exact label</th></tr>
|
||||
<tr><td>Popover header icons</td><td><code>Edit review details</code> (tooltip + VoiceOver), <code>Settings</code> (tooltip “Settings (⌘,)”)</td></tr>
|
||||
<tr><td>Scope segmented control (VoiceOver “Capture”)</td><td><code>Area</code> · <code>Window</code> · <code>Browser</code> · <code>Screen</code></td></tr>
|
||||
<tr><td>Target line</td><td>Area: <code>800 × 600 on Display 1</code> + <code>Choose Area…</code> · Window: <code>Front window when you press ⌥⇧2</code> · Browser: <code>Front browser page when you press ⌥⇧2</code> · Screen: <code>Display 1 · 2560 × 1440</code>; non-area scopes add <code>area kept: 800 × 600</code></td></tr>
|
||||
<tr><td>Empty pages</td><td><code>No pages yet</code> / <code>⌥⇧2 captures the area|window|page|screen</code></td></tr>
|
||||
<tr><td>Verbs</td><td><code>Capture ⌥⇧2</code>, <code>Send</code> (empty, disabled) / <code>Send 3 pages</code>, OneDrive: <code>Save 3 pages</code>; <code>New Session…</code>, <code>Open Redline</code></td></tr>
|
||||
<tr><td>New-session step</td><td>Title <code>New session</code>; subtitle <code>The current 3 pages are kept as a past session.</code>; groups <code>Capture</code>, <code>Review details</code> + <code>Edit…</code>; buttons <code>Cancel</code>, <code>Start Session</code></td></tr>
|
||||
<tr><td>Scope menu (⌥⇧1)</td><td>Header <code>Capture</code>; <code>Saved Area</code> (1), <code>Front Window</code> (2), <code>Browser Page</code> (3), <code>Whole Screen</code> (4), <code>Choose New Area…</code> (A)</td></tr>
|
||||
<tr><td>Status line (only when news)</td><td><code>Captured page 4</code> · <code>Sent · 3 pages</code> · <code>Saved to OneDrive · 3 pages</code> · <code>OMS test lane came back · 2 pages marked</code> + <code>Open</code> · <code>No front window to capture</code> · <code>No browser window in front</code> · <code>Redline 0.6.0 is ready — restarts after you send</code> + <code>Restart Now</code></td></tr>
|
||||
<tr><td>Settings</td><td>Groups <code>Capture</code>, <code>Sending</code>, <code>Sessions</code>, <code>Updates</code>; rows as in 3a; captions as in 3a/3b; footer <code>Quit Redline</code></td></tr>
|
||||
</table>
|
||||
<h2 class="sh2">Keyboard</h2>
|
||||
<p><b>Global:</b> ⌥⇧2 capture with the session’s scope · ⌥⇧1 open the capture menu (1–4 or A picks and captures). <b>Popover Tab order:</b> Edit review details → Settings → scope segments (←/→ move) → Choose Area… → Capture → Send → New Session… → Open Redline. Return = Send when enabled, otherwise Capture; Escape closes. ⌘, opens Settings; ⌘N = New Session…; ⌘Q quits. <b>New-session step:</b> Tab scope → Choose Area… → Edit… → Cancel → Start Session; Return = Start Session, Escape = Cancel. <b>Window:</b> ⌘N New Session…, ⌘S Send, ⌘, Settings, ⌘F search.</p>
|
||||
<h2 class="sh2">Scope states</h2>
|
||||
<p>The scope belongs to the session and is copied to the next one. <b>Area</b> uses the saved rectangle; if none is saved, Capture first runs the picker. <b>Window</b> grabs the frontmost window of the app that was front before Redline (never Redline itself); none → status “No front window to capture”, nothing added. <b>Browser</b> grabs the frontmost Safari / Chrome / Arc / Edge / Firefox window, page area only; no browser in front → “No browser window in front”. <b>Screen</b> grabs the display the pointer is on. Choosing Window, Browser or Screen never clears the saved area: it is shown as “area kept” and comes back when Area is chosen. Choose Area… / Choose New Area… always replaces the saved area and switches the scope to Area.</p>
|
||||
<h2 class="sh2">Information architecture</h2>
|
||||
<p>The capture decision lives in the popover, above the pages, as a four-way segmented control with the target line under it — and again, unmissably, in the New Session… step, which replaces the page strip until Start Session. The window header mirrors the scope as a pop-up next to the verbs. Settings has one door: the gear in the popover header (⌘, from anywhere in Redline); the window has no gear and the popover has no “…” menu. Popover hierarchy, top to bottom: what is being reviewed (lane, build, commit, reviewer) → what will be captured (scope, target) → what has been captured (pages) → news (one status line, only when there is any) → verbs (Capture, Send) → session control (New Session…, Open Redline). Updates move into Settings › Updates and surface in the popover only when an installed update is waiting.</p>
|
||||
<h2 class="sh2">Still the biggest thing wrong</h2>
|
||||
<p>The popover still carries two jobs at once — deciding what to capture and reviewing what was captured — and the real fix is to make the session, not the popover, the unit of decision: every capture rule (scope, area, lane, build, commit) should be set once, when the session starts, and then stay out of the way. Today the new-session step is the only place that treats it that way; until scope and details are locked per session (with change visibly recorded on the PDF when they change mid-session), a reviewer can still produce a PDF whose pages were captured under different rules without anyone noticing.</p>
|
||||
</div>
|
||||
</section>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user