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 ¶
const RemoteClipboardEnv = "KIT_REMOTE_CLIPBOARD"
RemoteClipboardEnv is the environment variable the daemon sets on remote-session child processes: it names a file holding the CLIENT machine's clipboard image. When set, ReadImage serves the image from that file instead of the local system clipboard — a remote session's Ctrl-V must attach the client's clipboard, not the daemon host's.
Variables ¶
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.