Documentation
¶
Overview ¶
Package clipboard reads a bounded snapshot of text, encoded images and file paths without linking to the UI. macOS uses AppKit; Windows uses Win32; Linux uses Wayland when given a display (UseWaylandDisplay), else X11.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Read ¶
Read asynchronously reads the clipboard on the platform's required thread. done runs once on a background goroutine. UI callers must dispatch UI changes. macOS supports PNG/TIFF and file URLs, up to 128 items and 16MiB encoded data. Windows supports Unicode text, PNG or packed DIB (returned as image/bmp), and file paths, with the same limits. Linux reads text, file URIs and PNG/JPEG/TIFF/BMP/WebP over Wayland or X11. Other platforms return native.ErrUnsupported. Nil done is ignored.
func UseWaylandDisplay ¶ added in v0.0.4
UseWaylandDisplay makes Read use a Wayland connection, the wl_display of the application's focused window (window.Window.WaylandDisplay). Wayland shows the clipboard only to the focused client, so Read cannot open a connection of its own. Nil, or a display without a data device, falls back to X11 (XWayland). Pass the display again when focus moves to another window; it must stay open until Read completes.