clipboard
Read and write the OS clipboard by driving the platform's own tool: pbcopy on macOS, clip on Windows, wl-copy or xclip on Linux.
ecko get github.com/ecko-lang/clipboard
import clipboard
Declares exec and env. A capability is only advisory in the manifest: what the package actually gets is the grant you give it when you import it.
Version 0.30.0 - source - MIT.
backend()
backend() -> the tool this machine would use, or null when there is none.
Useful in a diagnostic or a bug report: "xclip" and "wl-copy" behave differently under a Wayland session running XWayland, and knowing which one answered explains a clipboard that seems to write but never paste.
available()
available() -> whether copy and paste will work here.
Answers false rather than raising, so a program can degrade politely - print the text instead of copying it - rather than wrapping every call in try.
copy(text)
copy(text) -> null, having put text on the clipboard.
Raises kind clipboard when no tool is installed, naming what to install.
clipboard.copy("hello")
paste()
paste() -> the clipboard's contents as text, or "" when it is empty.
Raises kind clipboard when no tool is installed.
clipboard.paste()