Add support for primary clipboard

This commit is contained in:
Mattias Eriksson 2024-02-07 17:25:40 +01:00 committed by Héctor Ramón Jiménez
parent 7615b2240c
commit 4155edab8d
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
7 changed files with 96 additions and 1 deletions

View file

@ -8,6 +8,12 @@ pub trait Clipboard {
/// Writes the given text contents to the [`Clipboard`].
fn write(&mut self, contents: String);
/// Reads the current content of Primary as text.
fn read_primary(&self) -> Option<String>;
/// Writes the given text contents to Primary.
fn write_primary(&mut self, contents: String);
}
/// A null implementation of the [`Clipboard`] trait.
@ -20,4 +26,10 @@ impl Clipboard for Null {
}
fn write(&mut self, _contents: String) {}
fn read_primary(&self) -> Option<String> {
None
}
fn write_primary(&mut self, _contents: String) {}
}