pub struct WaylandClipboardContext { /* private fields */ }
Expand description

Interface to the clipboard for Wayland windowing systems.

Other users of the Wayland clipboard will only see the contents copied to the clipboard so long as the process copying to the clipboard exists. If you need the contents of the clipboard to remain after your application shuts down, consider daemonizing the clipboard components of your application.

WaylandClipboardContext automatically detects support for and uses the primary selection protocol.

Example

use cli_clipboard::ClipboardProvider;
let mut clipboard = cli_clipboard::wayland_clipboard::WaylandClipboardContext::new().unwrap();
clipboard.set_contents("foo bar baz".to_string()).unwrap();
let contents = clipboard.get_contents().unwrap();

assert_eq!(contents, "foo bar baz");

Trait Implementations§

Constructs a new WaylandClipboardContext that operates on all seats using the data-control clipboard protocol. This is intended for CLI applications that do not create Wayland windows.

Attempts to detect whether the primary selection is supported. Assumes no primary selection support if no seats are available. In addition to returning Err on communication errors (such as when operating in an X11 environment), will also return Err if the compositor does not support the data-control protocol.

Pastes from the Wayland clipboard.

If the Wayland environment supported the primary selection when this context was constructed, first checks the primary selection. If pasting from the primary selection raises an error or the primary selection is unsupported, falls back to the regular clipboard.

An empty clipboard is not considered an error, but the clipboard must indicate a text MIME type and the contained text must be valid UTF-8.

Copies to the Wayland clipboard.

If the Wayland environment supported the primary selection when this context was constructed, this will copy to both the primary selection and the regular clipboard. Otherwise, only the regular clipboard will be pasted to.

Method to clear the clipboard

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait. Read more
Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait. Read more
Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s. Read more
Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s. Read more
Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.