diff --git a/wayshot/src/cli.rs b/wayshot/src/cli.rs index 418ac8d8..6cf9b9f5 100644 --- a/wayshot/src/cli.rs +++ b/wayshot/src/cli.rs @@ -43,4 +43,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, + + /// Arguments to call slurp with for selecting a region + #[arg(short, long, value_name = "folder")] + pub folder: Option, } diff --git a/wayshot/src/wayshot.rs b/wayshot/src/wayshot.rs index 37152a79..27d409bd 100644 --- a/wayshot/src/wayshot.rs +++ b/wayshot/src/wayshot.rs @@ -1,5 +1,6 @@ use std::{ io::{stdout, BufWriter, Cursor, Write}, + path::PathBuf, process::Command, }; @@ -60,7 +61,18 @@ fn main() -> Result<()> { Some(pathbuf) } } - None => Some(utils::get_default_file_name(requested_encoding)), + None => { + let mut temp = PathBuf::new(); + match cli.folder { + Some(path) => { + temp.push(path); + } + None => {} + } + + temp.push(utils::get_default_file_name(requested_encoding)); + Some(temp) + } }; let wayshot_conn = WayshotConnection::new()?;