CLI Clipboard
cli-clipboard is a fork of rust-clipboard that adds wayland support for terminal and window-less applications via wl-clipboard-rs. For terminal applications it supports copy and paste for both wayland and X11 linux environments, macOS and windows.
Consider this alpha software. The tests pass on linux, macOS and windows but it has not yet been manually tested on every platform.
Example
use cli_clipboard;
API
ClipboardProvider
The ClipboardProvider
trait has the following functions:
;
;
;
ClipboardContext
ClipboardContext
is a type alias for one of {WindowsClipboardContext
,OSXClipboardContext
,X11ClipboardContext
,NopClipboardContext
}, all of which implementClipboardProvider
. Which concrete type is chosen forClipboardContext
depends on the OS (via conditional compilation).WaylandClipboardContext
is also available but is never assigned toClipboardContext
.
Convenience Functions
get_contents
and set_contents
are convenience functions that create a context for you and call the respective function on it. They correctly work on linux by attempting to create a wayland context and falling back to X11 if an error occurs.
Alternatives
- copypasta - rust-clipboard fork adding wayland support for windowed applications
- The original rust-clipboard
License
cli-clipboard
is dual-licensed under MIT and Apache2.