-
Notifications
You must be signed in to change notification settings - Fork 324
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
.copy
is not working on Linux X11
#160
Comments
.copy
is nor working on Linux X11.copy
is not working on Linux X11
Yes, tried again like in the picture. |
Ok, tried with the library arboard on local. Here's my debugging steps, not super familiar with rust but I think this has something to do with text reference vs actual data? use std::time::Duration;
use arboard::Clipboard;
fn main() {
copy("this does not work");
let mut clipboard = Clipboard::new().unwrap();
clipboard.set_text("this works").unwrap();
// give it a second to sync with clipboard before exiting the program
std::thread::sleep(Duration::from_secs(1));
}
pub fn copy(src: &str) {
let mut clipboard = Clipboard::new().unwrap();
clipboard.set_text(src).unwrap();
} |
Aah, got it, you need some delay in the function use std::time::Duration;
use arboard::Clipboard;
fn main() {
copy("this was not working earlier but now works");
let mut clipboard = Clipboard::new().unwrap();
clipboard.set_text("this works").unwrap();
// give it a second to sync with clipboard before exiting the program
// std::thread::sleep(Duration::from_secs(1));
}
pub fn copy(src: &str) {
let mut clipboard = Clipboard::new().unwrap();
clipboard.set_text(src).unwrap();
std::thread::sleep(Duration::from_secs(1)); // <-- this is the fix
} Used |
Is 1 second is enough? or 100 milliseconds is enough? It is better to wait for arboard to fix related problems. |
auto copy is also not working and I think this is why: use std::time::Duration;
use arboard::Clipboard;
fn main() {
let mut clipboard = Clipboard::new().unwrap();
copy(&mut clipboard, "hello");
// give it a second to sync with clipboard before exiting the program
// only needed in this test cli, not in aichat
std::thread::sleep(Duration::from_secs(1));
}
pub fn copy(clipboard: &mut Clipboard, src: &str) {
clipboard.set_text(src).unwrap();
} |
cloud you test #161 for me? |
Works like a charm. Also tested the |
You're welcome and thank you for your contribution. |
.copy
is not working and nothing happens, not even after quitting the app.echo ok | xclip -selection clipboard -i
this worksThe text was updated successfully, but these errors were encountered: