linux: clipboard (#8822)

Linux clipboard implementation with `copypasta`.


Release Notes:

- Added linux clipboard support
This commit is contained in:
Rom Grk 2024-03-04 11:00:24 -05:00 committed by GitHub
parent 33ef5b7731
commit 996f1036fc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 216 additions and 9 deletions

View file

@ -354,12 +354,21 @@ impl Platform for LinuxPlatform {
false
}
// todo(linux)
fn write_to_clipboard(&self, item: ClipboardItem) {}
fn write_to_clipboard(&self, item: ClipboardItem) {
let clipboard = self.client.get_clipboard();
clipboard.borrow_mut().set_contents(item.text);
}
// todo(linux)
fn read_from_clipboard(&self) -> Option<ClipboardItem> {
None
let clipboard = self.client.get_clipboard();
let contents = clipboard.borrow_mut().get_contents();
match contents {
Ok(text) => Some(ClipboardItem {
metadata: None,
text,
}),
_ => None,
}
}
//todo!(linux)
@ -382,6 +391,8 @@ impl Platform for LinuxPlatform {
})
}
//todo!(linux): add trait methods for accessing the primary selection
//todo!(linux)
fn read_credentials(&self, url: &str) -> Task<Result<Option<(String, Vec<u8>)>>> {
let url = url.to_string();