-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Request] Support for Klipper (KDE Plasma, X11 & Wayland) #114
Comments
Hey there, thanks for the issue. Can I ask how you tested out I suspect that this is due to either how data handoff is done in Wayland or maybe the nature of |
Hi, I tested both arboard and another clipboard library (cli clipboard) via: // rs
ctx.set_text(password.clone()); Neither of them would send the text into the kde clipboard. // rs
if cfg!(unix) {
// Create pipe
let mut pipe = Command::new("echo").arg(&password).stdout(Stdio::piped()).spawn().unwrap();
if let Some(pipe_out) = pipe.stdout.take() {
// Ok, copy
let mut out = Command::new("xclip").arg("-selection").arg("clipboard").stdin(pipe_out).spawn().unwrap();
match out.wait() {
Ok(s) => {
if s.success() {
try_set_text = false;
} else {
eprintln!("Failed to copy to xclip's clipboard");
}
}
Err(e) => {
eprintln!("Failed to run xclip, error: {}", e);
}
}
} else {
eprintln!("Failed to take pipe stdout");
}
} |
I just came because I am having the same problem in a project I have, basically only allows to paste the items that have been copied from arboard but while the application is still open, as soon as it closes it loses all the items that have been copied, this is good for a clipboard manager, but not for applications that want to consume the clipboard, is there any solution from the library?
|
That's interesting, @tulpenkiste, thanks for sharing. So Klipper persistently stores the data you pipe via
This is, as far as I know, a fundamental limitation of the clipboard of X11. Data copied to the clipboard lives inside the copiers process and gets requested by other apps on-demand via window messages. This is also one of the main reasons clipboard managers exist: to act as a persistent buffer to other applications which may be opening or closing often. We also implemented a wait function to help with this situation. It will block the current thread until something else has replaced the clipboard contents. I don't think that's what either of you want though, so it is only a reference point. As far as I know, @SergioRibera May I ask you to try running your app with |
Of course, here I leave you the logs that my application launched, apparently it happens what you say, then I dare to say that this is a problem that only occurs in distributions that do not have an integrated or external Clipboard Manager, I find it curious the truth, I would expect it to work otherwise |
Yes, it will persistently store data piped into xclip. |
KDE Plasma uses their own clipboard manager (klipper) and as a result, the string passed into set_text is not accessible via CTRL+V/Super+V.
The text was updated successfully, but these errors were encountered: