linux: clipboard (#8822)
Linux clipboard implementation with `copypasta`. Release Notes: - Added linux clipboard support
This commit is contained in:
parent
33ef5b7731
commit
996f1036fc
6 changed files with 216 additions and 9 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue