From aaf4aa9a7885e0c19408d8030c3b6646aad2b982 Mon Sep 17 00:00:00 2001 From: Matteo Casonato Date: Thu, 21 Jul 2022 00:12:35 +0200 Subject: [PATCH 1/2] Wait output gets copied in clipboard (Linux) Without that new line, i didn't get the output copied in my clipboard (I'm using Ubuntu 22.04) --- src/main.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 69f201e..47e777b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,5 @@ use std::env; - +use std::{thread, time}; use clipboard::{ClipboardContext, ClipboardProvider}; fn main() { @@ -25,4 +25,5 @@ fn main() { let mut ctx: ClipboardContext = ClipboardProvider::new().unwrap(); ctx.set_contents(output).unwrap(); // Copy the header to clipboard. + thread::sleep(time::Duration::from_secs(1)); // This is for Linux users. } From 5c32ce7a5d17886171865629d54f8fa580c5d0a7 Mon Sep 17 00:00:00 2001 From: caso Date: Sun, 28 Apr 2024 21:19:58 +0200 Subject: [PATCH 2/2] sleep less --- src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 47e777b..ecd8b26 100644 --- a/src/main.rs +++ b/src/main.rs @@ -25,5 +25,5 @@ fn main() { let mut ctx: ClipboardContext = ClipboardProvider::new().unwrap(); ctx.set_contents(output).unwrap(); // Copy the header to clipboard. - thread::sleep(time::Duration::from_secs(1)); // This is for Linux users. + thread::sleep(time::Duration::from_millis(100)); // This is for Linux users. }