clipboard

package
v0.34.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

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

View Source
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

View Source
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

func IsPastePath(word string) bool

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

func SaveImage() (string, error)

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

func SaveToTemp(data []byte, ext string) (string, error)

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

func SweepStale(maxAge time.Duration) error

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

func WriteText(text string) error

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL