Documentation
¶
Overview ¶
Package clipboard provides cross-platform clipboard image reading for Kit.
Terminals cannot paste binary image data via bracketed paste — only text is supported. To read images we shell out to platform-specific clipboard tools:
- Linux X11: xclip -selection clipboard -t image/png -o
- Linux Wayland: wl-paste --type image/png
- macOS: osascript + pbpaste (via a helper that reads NSPasteboard)
- Windows/WSL: powershell Get-Clipboard -Format Image (not yet supported)
The ReadImage function returns the raw image bytes and detected MIME type, or an error if no image is available on the clipboard.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoClipboardTool = fmt.Errorf("no clipboard tool available (install xclip, wl-paste, or use macOS)")
ErrNoClipboardTool is returned when no suitable clipboard tool is found.
View Source
var ErrNoImage = fmt.Errorf("no image data on clipboard")
ErrNoImage is returned when the clipboard does not contain image data.
Functions ¶
func DetectMediaType ¶
DetectMediaType inspects the magic bytes of data to determine the image MIME type. Returns empty string if the format is not recognized.
Types ¶
Click to show internal directories.
Click to hide internal directories.