-
-
Notifications
You must be signed in to change notification settings - Fork 605
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
Replace cli-clipboard
with arboard
#2067
Conversation
cli-clipboard
with arboard
84176e8
to
1b55540
Compare
@ovv, seems that
Maybe the same fix you had in #2028 works here? Edit: Well, I can confirm that having the sleep at least worked for me :/. The |
[target.'cfg(any(target_os = "windows", target_os = "macos", target_os = "linux"))'.dependencies] | ||
cli-clipboard = { version = "0.4.0", optional = true } | ||
[target.'cfg(any(target_os = "windows", target_os = "macos"))'.dependencies] | ||
arboard = { version = "3.4", optional = true } | ||
|
||
[target.'cfg(target_os = "linux")'.dependencies] | ||
arboard = { version = "3.4", optional = true, features = ["wayland-data-control"] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about this one, but would want to have at least an option to enable the native wayland support.
1b55540
to
6c8d224
Compare
cli_clipboard::set_contents(s).unwrap(); | ||
let mut ctx = arboard::Clipboard::new().unwrap(); | ||
ctx.set_text(s.clone()).unwrap(); | ||
// Use the clipboard context to make sure it is saved | ||
ctx.get_text().unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The get_text()
seems to make sure that the clipboard content is saved, solving #2028. But I think it should be in a short loop to check the contents are equal. Any preference on what loop to do here?
6c8d224
to
e2a1a05
Compare
Note: I seem to encounter a bug where I can't copy something from a window (maybe XWayland), but if I try on another window (maybe native wayland) to copy it recovers. I can't seem to reliably reproduce, but it reminds me of a bug that used to happen in KeepassXC: keepassxreboot/keepassxc#8492 (comment) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure happy with the clipboard state on linux, but this seems fine for now.
If we face any more weird edge cases, I'd rather disable the clipboard feature by default on Linux than either have unreliable behaviour or a sleep introduced.
e2a1a05
to
1398241
Compare
1398241
to
910ff1d
Compare
Unfortunately I don't think this is covered by the tests, so I am not sure how correct it is. I've mostly followed the example here
Checks
closes #2028
@ovv Could you give it a try? the current fix here seems to work on my end, but I don't think it's reliable