cargo: switch out dead clipboard crate with arboard

Signed-off-by: Christoph Heiss <christoph@c8h4.io>
This commit is contained in:
Christoph Heiss 2024-08-16 16:19:01 +02:00
parent 318c81200a
commit a78870d47a
Signed by: c8h4
GPG key ID: 1538094429952F86
3 changed files with 927 additions and 478 deletions

1387
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -10,7 +10,6 @@ repository = "https://git.c8h4.io/c8h4/bwtui"
description = "terminal-based vault browser for bitwarden"
[dependencies]
clipboard = "0.5.0"
cursive_buffered_backend = "0.6.0"
cursive_table_view = "0.14.0"
directories = "5.0.1"
@ -18,6 +17,11 @@ fuzzy-matcher = "0.3.7"
serde_json = "1.0.83"
unicase = "2.6.0"
[dependencies.arboard]
version = "3.4"
default-features = false
features = ["wayland-data-control"]
[dependencies.bitwarden]
path = "bitwarden"

View file

@ -5,8 +5,6 @@ use std::fs::{self, File};
use std::io::{BufReader, BufWriter};
use std::path::PathBuf;
use clipboard::ClipboardContext;
use clipboard::ClipboardProvider;
use cursive::event::{Event, Key};
use cursive::traits::*;
use cursive::views::{Dialog, DummyView, EditView, LinearLayout, OnEventView, TextView};
@ -128,9 +126,8 @@ pub fn create(siv: &mut Cursive) {
siv.call_on_name("password_table", |view: &mut VaultTableView| {
if let Some(row) = view.item() {
if let Some(entry) = view.borrow_item(row) {
let mut clipboard: ClipboardContext = ClipboardProvider::new().unwrap();
clipboard.set_contents(entry.username.to_string()).unwrap();
let mut clipboard = arboard::Clipboard::new().unwrap();
clipboard.set_text(entry.username.to_string()).unwrap();
}
}
})
@ -140,9 +137,8 @@ pub fn create(siv: &mut Cursive) {
siv.call_on_name("password_table", |view: &mut VaultTableView| {
if let Some(row) = view.item() {
if let Some(entry) = view.borrow_item(row) {
let mut clipboard: ClipboardContext = ClipboardProvider::new().unwrap();
clipboard.set_contents(entry.password.clone()).unwrap();
let mut clipboard = arboard::Clipboard::new().unwrap();
clipboard.set_text(&entry.password).unwrap();
}
}
})