clipboard

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clear

func Clear() error

Clear removes all data from the clipboard.

func IsNoData

func IsNoData(err error) bool

IsNoData returns whether an error indicates that no data was found.

func Read

func Read(formats ...string) (f int, b []byte, err error)

Read gets data from the clipboard. If multiple clipboard formats are supported, Read selects the first format that matches one of the given media types.

Each argument is a media type (e.g. "text/plain").

If an error is returned, then f will be less than 0. If no data was found, then the error will contain NoDataError. If no formats were given, then f will be less than 0, and err will be nil.

func Write

func Write(formats []Format) (err error)

Write sets data to the clipboard. If multiple formats are supported, then each given format is written according to the specified media type. Otherwise, which format is selected is implementation-defined.

If no formats are given, then the clipboard is cleared with no other action.

Types

type Format

type Format struct {
	// Name is a media type that indicates how to interpret Content.
	Name string
	// Content is the data to be set to the clipboard.
	Content []byte
}

Format associates a media type with content.

type NoDataError

type NoDataError struct {
	// contains filtered or unexported fields
}

NoData indicates that no data was found for any of a number of given formats.

func (NoDataError) Error

func (err NoDataError) Error() string

func (NoDataError) NotImplemented

func (err NoDataError) NotImplemented() bool

NotImplemented indicates that the clipboard has no data because it is not implemented for the platform.

Jump to

Keyboard shortcuts

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