arboard
arboard copied to clipboard
set_text is not working properly
When I use the set_text method, the text isn't set to the clipboard. But when I add a little delay before the program exists it works. Here is the code
let clipboard = Clipboard::new();
match clipboard {
Ok(mut clipboard) => {
let text = clipboard.set_text("hello world 2".to_string());
match text {
Ok(_) => {
println!("OK");
//std::thread::sleep(std::time::Duration::from_millis(10));
}
Err(_) => {
println!("Error");
}
}
},
Err(_) => {
}
}
When I uncomment the std::thread::sleep(std::time::Duration::from_millis(10)); it works. But I guess this isn't the intended behaviour
Hi there @DodyAlkarkhi. What operating system and desktop environment are you seeing this behavior on?
Hi there @DodyAlkarkhi. What operating system and desktop environment are you seeing this behavior on?
Hi.
OS is Debian sid and desktop environment is KDE Plasma
It sounds like you may be running into the same problem that #39 with how the dropping Clipboard interacts with the X11 window server.
If you move the mut clipboard binding outside of the match i.e using .unwrap() for example, then the text should be available outside of that first Ok block.
Hey there again. I'm going to go ahead and close this one now that 3.0 is out with the wait function. If you need to access clipboard contents longer, I would recommend using this function or keeping the Clipboard struct around longer.