Skip to content

feat(cli): serve Defi's window pictures with window-preview - #267

Closed
qeude wants to merge 1 commit into
mainfrom
feat/cli-window-preview
Closed

qeude wants to merge 1 commit into
mainfrom
feat/cli-window-preview

Conversation

@qeude

@qeude qeude commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner

Summary

defi window-preview <id> prints the latest picture Defi holds of a window as a JPEG data URI, at most 800 pixels long. The Raycast extension (#261) uses it to show window pictures, so the launcher captures nothing and needs no Screen Recording of its own.

IPC request "window-preview <id>"
  windowPreviewResponse            # on the IPC client queue, before the navigation queue
    windowPreviewDataURI(id)       # DefiMacOS
      RibbonProxyStore.isAuthorized  → "Defi needs Screen Recording…"
      WindowCaptureStore.picture(id) → "Defi has no picture of window <id> yet."
      windowPreviewJPEG             # scale to ≤800 px, fill clear corners with the edge colour
  • Reads the existing capture store only: no new capture, no disk, no change to capture cadence or budgets.
  • Served over the per-user socket like window titles; documented in CONFIGURATION.md and docs/internals/overview-capture.md.

Evidence

  • WindowPreviewTests: a 1600×1000 picture with a clear corner becomes an 800×500 JPEG whose corner takes the edge colour, and a small picture is never scaled up.
  • WindowPreviewResponseTests: picture, Screen Recording missing, no picture yet, bad usage, other commands untouched.
  • make verify passes.
  • Not verified: the daemon path on a real desktop (make verify-desktop and the installed build were not run).

Merge Danger

Door: two-way

Blast Radius: small. One new read-only IPC command. It exposes window pictures to any process of the same user that can reach the socket, the same trust boundary as window titles today.

Note

Add window-preview CLI command to serve window pictures as JPEG data URIs

  • Adds windowPreviewDataURI in WindowPreview.swift, which checks Screen Recording authorization, reads the window's picture from the capture store, and returns a JPEG data URI (max side 800px, quality 0.75, no upscaling, transparent areas filled white).
  • Adds the window-preview <id> command handler in DaemonCommands.swift. It is answered before the read-response cache and deferred-command paths, and maps authorization, missing-picture, and argument errors to command responses.
  • The command only reads the capture store; it starts no capture. Previews are served over the per-user Unix socket and are not written to diagnostics files.
  • Adds tests for the command responses and the JPEG encoder, plus CLI and capture documentation updates.

Macroscope summarized f1fb660.

defi window-preview <id> prints the latest picture Defi holds of a
window as a JPEG data URI, at most 800 pixels long. It reads the capture
store on the IPC queue, never starts a capture and never touches the
disk, so a launcher can show window pictures without asking for Screen
Recording itself.
@github-actions github-actions Bot added the macroscope-review Request a Macroscope review label Nov 11, 2026
@macroscopeapp

macroscopeapp Bot commented Nov 11, 2026

Copy link
Copy Markdown

Approvability

Verdict: Needs Human Approval

Macroscope's review found this PR requires human approval — The new command serves cached window pictures to socket clients using Defi's Screen Recording permission. Human judgment is needed on whether that access should be available to all socket clients or require explicit opt-in or client restrictions.

You can add or adjust custom eligibility rules. Learn more.

@qeude

qeude commented Nov 11, 2026

Copy link
Copy Markdown
Owner Author

Closing: the Raycast extension stays a simple list, like the other window manager extensions; no window pictures for now.

@qeude qeude closed this Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

macroscope-review Request a Macroscope review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant