Skip to content

Allow Custom Format #17

Open
Open
@changkun

Description

@changkun

Currently, we only support UTF-8 text and PNG-encoded image data. However, there are much more formats than that.

Let's support registering custom format and handlers so that this package can help any other unregistered format. API design could be:

package clipboard

type Format int

// Add this.
func Register[T any](format clipboard.Format, read func([]byte) (T, error), write func() []byte) error { ... }

func Read(format clipboard.Format) []byte
func Write(format clipboard.Format, data []byte)
func Watch(format clipboard.Format) <-chan struct{}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions