Documentation
¶
Overview ¶
Package clipboard reads image and file data out of the host system clipboard and spools it to disk, so it can be attached to a message.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoImage is returned when the clipboard holds nothing attachable. ErrNoImage = errors.New("clipboard holds no image or file") // ErrUnsupported is returned when the platform has no clipboard reader. ErrUnsupported = errors.New("clipboard paste is not supported on this platform") // ErrNoTool is returned when the required helper binary is missing. ErrNoTool = errors.New("no clipboard helper found (install wl-clipboard or xclip)") )
var ErrNoWriter = errors.New("no clipboard tool found for copying text")
ErrNoWriter is returned when the platform has no clipboard writer this build knows how to drive.
Functions ¶
func Cleanup ¶
func Cleanup()
Cleanup removes the spool directory and everything in it. It exists for tests; production code does not call it at exit. Bubble Tea v2 never waits for in-flight tea.Cmd goroutines on quit, so deleting the spool dir at exit races any upload still reading from it. Instead, the spool directory is named deterministically per process and the next process to start sweeps up any directory left behind by a process that is no longer running (see spool and sweepStaleSpools).
func Copy ¶
Copy puts text on the system clipboard.
Text only. There is no OSC 52 fallback: writing a base64 payload to the terminal to have it set the clipboard would work over ssh, where none of these helpers exist, but it is also the one clipboard path a user cannot see, cannot bound, and cannot decline — several terminals accept it silently and some multiplexers forward it onward. The design record (docs/tui-2.0.md, phase 8) gates it on explicit approval, which it has not been given, so an ssh session gets an honest "no clipboard tool found" rather than a surprise.
An empty string is a no-op rather than an error: "copy nothing" is what yanking an empty message means, and clearing the user's clipboard is not a service they asked for.
func IsImagePath ¶
IsImagePath reports whether path looks like an image Telegram can render inline as a photo.