pasteimg

package
v0.8.61 Latest Latest
Warning

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

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

Documentation

Overview

Package pasteimg is the host-side clipboard-image capture seam for the host→island image-paste bridge. Capturing an image off the system clipboard is inherently platform-specific, so the capture itself lives behind a single Capture() function with one implementation per OS (build-tagged files). The rest of the bridge — staging the bytes into the island's intake dir and injecting a `Read <path>` line — is platform-neutral and lives in the CLI.

When the running platform has no clipboard-image capture (or the clipboard holds no image), Capture returns ErrNoImage / ErrUnsupported and the caller degrades gracefully: the bridge is a convenience, never a hard dependency.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoImage = errors.New("no image on the clipboard")

ErrNoImage is returned when the platform supports capture but the clipboard currently holds no image (e.g. it holds text, or is empty).

View Source
var ErrUnsupported = errors.New("clipboard image capture is not supported on this platform")

ErrUnsupported is returned on platforms without a clipboard-image capturer.

Functions

func Supported

func Supported() bool

Supported reports whether this platform has a clipboard-image capturer at all, so callers can tailor help text without attempting a capture.

Types

type Image

type Image struct {
	Bytes []byte
	Ext   string
}

Image is a captured clipboard image: the raw encoded bytes plus the file extension (no dot, e.g. "png") describing their encoding.

func Capture

func Capture() (Image, error)

Capture reads an image off the host system clipboard. It returns ErrNoImage when the clipboard holds no image and ErrUnsupported on platforms without a capturer. Implementations are selected by build tags (pasteimg_darwin.go, pasteimg_other.go).

Jump to

Keyboard shortcuts

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