chore(deps): Replace cli-clipboard with arboard (#2067)

This commit is contained in:
Cristian Le 2024-07-10 18:20:30 +02:00 committed by GitHub
parent 69def05f75
commit 33925e3302
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 441 additions and 218 deletions

645
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -38,7 +38,7 @@ client = ["atuin-client"]
sync = ["atuin-client/sync"] sync = ["atuin-client/sync"]
daemon = ["atuin-client/daemon"] daemon = ["atuin-client/daemon"]
server = ["atuin-server", "atuin-server-postgres"] server = ["atuin-server", "atuin-server-postgres"]
clipboard = ["cli-clipboard"] clipboard = ["arboard"]
check-update = ["atuin-client/check-update"] check-update = ["atuin-client/check-update"]
[dependencies] [dependencies]
@ -86,8 +86,11 @@ unicode-segmentation = "1.11.0"
sysinfo = "0.30.7" sysinfo = "0.30.7"
regex="1.10.5" regex="1.10.5"
[target.'cfg(any(target_os = "windows", target_os = "macos", target_os = "linux"))'.dependencies] [target.'cfg(any(target_os = "windows", target_os = "macos"))'.dependencies]
cli-clipboard = { version = "0.4.0", optional = true } arboard = { version = "3.4", optional = true }
[target.'cfg(target_os = "linux")'.dependencies]
arboard = { version = "3.4", optional = true, features = ["wayland-data-control"] }
[dev-dependencies] [dev-dependencies]
tracing-tree = "0.3" tracing-tree = "0.3"

View File

@ -1181,7 +1181,10 @@ pub async fn history(
any(target_os = "windows", target_os = "macos", target_os = "linux") any(target_os = "windows", target_os = "macos", target_os = "linux")
))] ))]
fn set_clipboard(s: String) { fn set_clipboard(s: String) {
cli_clipboard::set_contents(s).unwrap(); let mut ctx = arboard::Clipboard::new().unwrap();
ctx.set_text(s).unwrap();
// Use the clipboard context to make sure it is saved
ctx.get_text().unwrap();
} }
#[cfg(not(all( #[cfg(not(all(