Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/x11_clipboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use std::marker::PhantomData;
use std::time::Duration;

use x11_clipboard::error::Error;
use x11_clipboard::Atom;
use x11_clipboard::{Atoms, Clipboard as X11Clipboard};

Expand Down Expand Up @@ -67,6 +68,16 @@ where
}

fn set_contents(&mut self, data: String) -> Result<()> {
Ok(self.0.store(S::atom(&self.0.setter.atoms), self.0.setter.atoms.utf8_string, data)?)
self.0.store(S::atom(&self.0.setter.atoms), self.0.setter.atoms.utf8_string, data).or_else(
|err| match err {
// The `Owner` error can be spurious, caused by a racy
// ownership check. The "store" will still have
// happened, so it is safe to ignore.
// https://github.com/quininer/x11-clipboard/pull/53 has
// more details.
Error::Owner => Ok(()),
e => Err(e.into()),
},
)
}
}
Loading