Add primary clipboard support for X11 and wayland

The X11 code already had the functionality. Just didn't expose it.

Signed-off-by: Mohammad AlSaleh <CE.Mohammad.AlSaleh@gmail.com>
This commit is contained in:
Mohammad AlSaleh 2024-01-18 07:12:22 +03:00
parent 40447db331
commit cb8471828a
4 changed files with 70 additions and 6 deletions

View file

@ -33,9 +33,19 @@ impl Clipboard {
Ok(self.context.lock().unwrap().load()?)
}
pub fn read_primary(&self) -> Result<String, Box<dyn Error>> {
Ok(self.context.lock().unwrap().load_primary()?)
}
pub fn write(&mut self, data: String) -> Result<(), Box<dyn Error>> {
self.context.lock().unwrap().store(data);
Ok(())
}
pub fn write_primary(&mut self, data: String) -> Result<(), Box<dyn Error>> {
self.context.lock().unwrap().store_primary(data);
Ok(())
}
}