Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions wayshot/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,8 @@ pub struct Cli {
/// Present a fuzzy selector for output/display selection
#[arg(long, alias = "chooseoutput", conflicts_with_all = ["slurp", "output"])]
pub choose_output: bool,

///Number of seconds to wait before taking the screenshot
#[arg(long, short, default_value = "0", value_name = "SECONDS")]
pub delay: u64,
}
9 changes: 8 additions & 1 deletion wayshot/src/wayshot.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::{
io::{stdout, BufWriter, Cursor, Write},
io::{self, stdout, BufWriter, Cursor, Write},
process::Command,
};

Expand Down Expand Up @@ -39,6 +39,13 @@ fn main() -> Result<()> {
.with_writer(std::io::stderr)
.init();

if cli.delay > 0 {
print!("Waiting {} seconds before capture...", cli.delay);
io::stdout().flush().ok();
std::thread::sleep(std::time::Duration::from_secs(cli.delay));
println!("Done!");
}

let input_encoding = cli
.file
.as_ref()
Expand Down