Documentation
¶
Overview ¶
Package clipboard reads image data off the OS clipboard so the quick prompt can attach a pasted screenshot to an agent session.
Index ¶
Constants ¶
const StaleAfter = 7 * 24 * time.Hour
StaleAfter is how long a pasted image stays on disk before a sweep can take it: long enough for an agent to reopen an image from an earlier session, short enough that screenshots do not pile up in temp.
Variables ¶
var ErrNoImage = errors.New("no image in clipboard")
ErrNoImage means the clipboard held no image when it was read.
Functions ¶
func IsPastePath ¶ added in v0.32.0
IsPastePath reports whether a word is one of the image paths a pasted picture becomes on its way to an agent, so a reader showing the prompt back can leave the pictures out of it.
func SaveImage ¶ added in v0.8.0
SaveImage writes a clipboard image into the pastes directory and returns its absolute path. Prefers an in-process native pasteboard read when available, then platform shell tools.
func SaveToTemp ¶
SaveToTemp writes image bytes to a uniquely named file under a shared pastes directory and returns its absolute path.
func SweepStale ¶ added in v0.14.0
SweepStale deletes paste files older than maxAge. A pasted image outlives the prompt that names it, so nothing deletes it at send time; age is what tells a spent paste from one an agent may still open. A pastes directory that does not exist yet is nothing to sweep.
func WriteText ¶ added in v0.13.0
WriteText puts plain text on the OS clipboard. Used by the focused preview's own selection, which the host terminal never sees because the app holds mouse reporting.
stdout and stderr stay unwired (os/exec points them at /dev/null): X11 writers like xclip fork a daemon that holds the selection, and any pipe it inherits keeps a capturing call waiting for EOF that never comes. The timeout covers a writer that hangs before daemonizing.
Types ¶
This section is empty.