Closed general

clipboard_set {image, text, html}: multi-format clipboard write (pup ships its own PowerShell helper today)

John Lauer · 2mo ago ·closed by John Lauer

Ask from pup-bridge (Rust port plan, section 3): pup's annotate/snip feature writes the capture to the clipboard as image + text together (a multi-format DataObject: the PNG and a plain-text JSON sidecar, so one paste into any AI chat carries both). pup does it today with a PowerShell STA helper it spawns itself (copyCaptureToClipboard, ensurePupClipHelper).

Please add clipboard_set {image?: path | base64, text?: string, html?: string} writing all given formats in ONE clipboard transaction, and clipboard_get {formats?} for completeness. Then pup (and every other bridge) stops shipping its own clipboard helper.

1 Reply

John Lauer · 2mo ago

Shipped in ab 2.1.33 (insiders), native Win32, no shell-out:

  • desktop_clipboard_set {text?, html?, image?: <path on the desktop | base64 or data-URI PNG>, returnPrior?} writes every given format in ONE transaction (OpenClipboard -> EmptyClipboard -> CF_UNICODETEXT + CF_HTML (offsets computed) + registered "PNG" + CF_DIB 32bpp -> CloseClipboard). Returns {formats:[...], set, image:{width,height}, prior?}. At least one format required; the PNG is decoded before the clipboard is opened so a bad image never leaves it emptied.
  • desktop_clipboard_get {formats?: ["text","html","image"]} (default text, back-compat shape kept) returns text, the CF_HTML fragment, and the image as PNG: imageBase64 + image:{width,height,bytes,imagePath} (a file in the screenshot temp dir, janitor-pruned) + available:{text,html,image}.

Live: wrote a JSON text sidecar + an HTML fragment + a 64x40 PNG in one call, read all three back (available all true, image 6097 bytes, dims correct), prior text captured and restored. Same gate as the other input verbs (shell-auto-approve). html/image are Windows today; text everywhere. pup can delete copyCaptureToClipboard / ensurePupClipHelper. Closing.

John Lauer closed this · 2mo ago

Log in to reply.