add clipboard

This commit is contained in:
Medzik 2022-02-23 22:39:37 +01:00
parent 86397d5e23
commit 39f1debdd2
No known key found for this signature in database
GPG Key ID: A5FAC1E185C112DB
4 changed files with 2191 additions and 2 deletions

2
.gitignore vendored
View File

@ -2,5 +2,3 @@
# will have compiled files and executables
/debug
/target
Cargo.lock

2186
Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -31,6 +31,7 @@ clap_complete = "3.0.5"
anyhow = "1.0.53"
better-panic = "0.3.0"
validator = "0.14.0"
arboard = "2.0.1"
[dependencies.clap]
version = "3.0.13"

View File

@ -11,6 +11,7 @@ use chrono::{prelude::DateTime, Utc};
use log::info;
use notify_rust::Notification;
use std::time::{Duration, UNIX_EPOCH};
use arboard::Clipboard;
pub fn print_image_info(i: ImageInfo, notify: bool) {
let d = UNIX_EPOCH + Duration::from_secs(i.data.datetime.try_into().unwrap());
@ -54,5 +55,8 @@ pub fn print_image_info(i: ImageInfo, notify: bool) {
.body(&format!("Uploaded {}", i.data.link))
.show()
.expect("send notification");
let mut clipboard = Clipboard::new().unwrap();
clipboard.set_text(i.data.link.into()).unwrap();
}
}