Skip to main content

WaylandClipboard

Struct WaylandClipboard 

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

wl_data_device + zwp_primary_selection_device_v1 on the app’s own Wayland connection. The focused client’s connection is required for the compositor to accept copies; a separate connection cannot substitute. Prefer Self::from_owned_display so every protocol worker and retained loader owns the display it uses.

Implementations§

§

impl WaylandClipboard

pub unsafe fn new(display_ptr: *mut c_void) -> WaylandClipboard

Attach to the wl_display behind display_ptr.

§Safety

display_ptr must remain live until this value AND every outstanding loader have finished. A timed-out text read can retain a loader after this value is dropped. Use Self::from_owned_display when that independent lifetime cannot be guaranteed.

pub fn from_owned_display( handle: impl HasDisplayHandle + Send + Sync + 'static, ) -> Option<WaylandClipboard>

Attach while retaining the actual display owner for every worker, including loaders that survive runner close.

Trait Implementations§

§

impl ClipboardBackend for WaylandClipboard

§

fn request_text(&self, target: ClipboardTarget) -> Receiver<Option<String>>

Request text for an explicit paste. A native transfer may finish after this call returns; the backend must wake its owner when it answers. No answer may substitute text from an older selection or focus owner.
§

fn set_text(&self, target: ClipboardTarget, text: &str) -> bool

Take ownership of target and offer text on it. Returns false if the backend could not.
§

fn set_rich_text(&self, html: &str, plain: &str) -> bool

Take the Ctrl+C clipboard and offer formatted text on it: html as text/html and plain as its plain-text fallback, both from one copy, so an app that reads formatting pastes the formatting and every other app the words. Returns false if the backend could not. Read more
§

fn set_secret_text(&self, text: &str) -> bool

Offer text on the Ctrl+V clipboard marked as a secret: a password, a one-time code, an enrolment token. Other apps can still paste it as plain text, but clipboard managers and Tilo’s own history and device sync are told not to keep it (SECRET_MIME, PASSWORD_MANAGER_HINT_MIME). Read more
§

fn text(&self, target: ClipboardTarget) -> Option<String>

Read target as UTF-8. None when it is empty, unavailable, or holds something that is not text.
§

fn set_image(&self, width: usize, height: usize, rgba: &[u8]) -> bool

Offer an RGBA8 image on the clipboard. Optional: the default refuses, which is appropriate for backends that only carry text.
§

fn copy(&self, content: CopyContent<'_>) -> ClipboardCopy

Start a Ctrl+C copy without waiting for it, and answer its outcome through the returned ClipboardCopy. A copy through an app’s own Wayland connection waits on compositor roundtrips; this lets the UI thread go on while it does, and wakes the app when it settles. Read more
§

fn rich_text(&self) -> Option<RichTextOffer>

Read HTML and its plain fallback from one Ctrl+V clipboard offer. Optional: unsupported backends return None without reading plain text. A successful read consumes event-scoped offers; use the captured plain fallback if decoding refuses the HTML. Never reread to recover a stale selection, a permission refusal, or an active composition.
§

fn image(&self) -> Option<ClipboardImage>

The image on the Ctrl+V clipboard, when it holds one: a screenshot, an image copied in a viewer or a browser. Optional: the default reads none, which is right for backends that only carry text.
§

fn name(&self) -> &'static str

Short name for diagnostics, e.g. "compositor-mirror".
§

fn set_shared_text(&self, target: ClipboardTarget, text: &str) -> bool

Offer text only where other processes can read it. Returns false rather than keeping it in a buffer private to this process, so a secret is never reported as copied when it was not. The default is set_text, right for a backend that only reaches a shared clipboard.
§

fn reserve_text(&self) -> Option<ReservedCopy>

Hold a Ctrl+C copy for text that is not known yet: a link the person’s click asks a host for. A browser copies only inside the click, so a backend with that rule claims the clipboard now and fills it once ReservedCopy::fill hands the text over. None when this backend copies just as well later, or has no way to claim the clipboard now; the text is then copied when it arrives.
§

impl Drop for WaylandClipboard

§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> AsAny for T
where T: 'static,

§

fn as_any(&self) -> &(dyn Any + 'static)

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

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.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSend for T
where T: Any + Send,

§

fn into_any_send(self: Box<T>) -> Box<dyn Any + Send>

Converts Box<Trait> (where Trait: DowncastSend) to Box<dyn Any + Send>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_sync(self: Box<T>) -> Box<dyn Any + Send + Sync>

Converts Box<Trait> (where Trait: DowncastSync) to Box<dyn Any + Send + Sync>, which can then be downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> ⓘ

Converts Arc<Trait> (where Trait: DowncastSync) to Arc<Any>, which can then be downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

§

fn simd_from(_simd: S, value: T) -> T

§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

§

fn simd_into(self, simd: S) -> T

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> Fruit for T
where T: Send + Downcast,

§

impl<T> MaybeSendSync for T
where T: Send + Sync + ?Sized,

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T

§

impl<T> WasmNotSync for T
where T: Sync,