Module copypasta_ext::wayland_bin
source · Expand description
Invokes wl-copy
/wl-paste
to access clipboard.
This provider allows setting clipboard contentx when using the Wayland display manager.
When getting or setting the clipboard, the wl-copy
and wl-paste
binary is invoked to manage the
contents. When setting the clipboard contents, these binaries are provided by the
wl-clipboard clipboard manager.
The wl-copy
or wl-paste
must be in PATH
. Alternatively the paths of either may be set at
compile time using the WL_COPY_PATH
and WL_PASTE_PATH
environment variables.
Use the provided ClipboardContext
type alias to use this clipboard context on supported
platforms, but fall back to the standard clipboard on others.
Benefits
- Keeps contents in clipboard even after your application exists.
Drawbacks
- Requires
wl-copy
andwl-paste
binaries fromwl-clipboard
clipboard manager. - Less performant than alternatives due to binary invocation.
- Set contents may not be immediately available, because they are set in an external binary.
- May have undefined behaviour if
wl-copy
orwl-paste
are modified.
Examples
use copypasta_ext::prelude::*;
use copypasta_ext::wayland_bin::WaylandBinClipboardContext;
let mut ctx = WaylandBinClipboardContext::new().unwrap();
println!("{:?}", ctx.get_contents());
ctx.set_contents("some string".into()).unwrap();
Use ClipboardContext
alias for better platform compatability:
use copypasta_ext::prelude::*;
use copypasta_ext::wayland_bin::ClipboardContext;
let mut ctx = ClipboardContext::new().unwrap();
println!("{:?}", ctx.get_contents());
ctx.set_contents("some string".into()).unwrap();
Structs
- Invokes
wl-clipboard
binaries to access clipboard.
Enums
- Represents Wayland binary related error.
Type Definitions
- Platform specific context.