feat: native clipboard image sync (Linux, opt-in sync_images)
This commit is contained in:
@@ -8,6 +8,12 @@
|
||||
// Each platform file defines its own New() constructor using //go:build tags.
|
||||
package clipboard
|
||||
|
||||
import "errors"
|
||||
|
||||
// ErrNoImage is returned by ImageClipboard.ReadImage when the clipboard holds
|
||||
// no image data. It is a normal condition, not an error.
|
||||
var ErrNoImage = errors.New("clipboard: no image")
|
||||
|
||||
// Clipboard is the cross-platform clipboard interface.
|
||||
type Clipboard interface {
|
||||
// Read returns the current text content of the clipboard.
|
||||
@@ -17,3 +23,15 @@ type Clipboard interface {
|
||||
// Write sets the clipboard text content.
|
||||
Write(text string) error
|
||||
}
|
||||
|
||||
// ImageClipboard is an optional interface implemented by platforms that can
|
||||
// read and write image data from the clipboard. Use a type assertion to detect
|
||||
// support: `if ic, ok := cb.(clipboard.ImageClipboard); ok { ... }`.
|
||||
type ImageClipboard interface {
|
||||
// ReadImage returns the MIME type and raw bytes of the clipboard image.
|
||||
// It returns ErrNoImage if the clipboard holds no image.
|
||||
ReadImage() (mime string, data []byte, err error)
|
||||
|
||||
// WriteImage sets the clipboard image content.
|
||||
WriteImage(mime string, data []byte) error
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user