Module copypasta_ext::wayland_bin[][src]

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 and wl-paste binaries from wl-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 or wl-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

WaylandBinClipboardContext

Invokes wl-clipboard binaries to access clipboard.

Enums

Error

Represents Wayland binary related error.

Type Definitions

ClipboardContext

Platform specific context.