1
0
Fork 0
forked from wry/wry

autocommit 2022-04-17 17:08:31 CEST

This commit is contained in:
Julian Orth 2022-04-17 17:08:31 +02:00
parent 50b792db78
commit a30306e3d5
23 changed files with 390 additions and 42 deletions

View file

@ -3,6 +3,7 @@ mod log;
mod quit;
mod screenshot;
mod set_log_level;
mod idle;
use {
crate::compositor::start_compositor,
@ -41,6 +42,52 @@ pub enum Cmd {
Quit,
/// Take a screenshot.
Screenshot(ScreenshotArgs),
/// Inspect/modify the idle (screensaver) settings.
Idle(IdleArgs),
}
#[derive(Args, Debug)]
pub struct IdleArgs {
/// The filename of the saved screenshot
///
/// If no filename is given, the screenshot will be saved under %Y-%m-%d-%H%M%S_jay.qoi
/// in the current directory.
///
/// The filename can contain the usual strftime parameters.
#[clap(subcommand)]
pub command: Option<IdleCmd>,
}
#[derive(Subcommand, Debug)]
pub enum IdleCmd {
/// Print the idle status.
Status,
/// Set the idle interval.
Set(IdleSetArgs),
}
impl Default for IdleCmd {
fn default() -> Self {
Self::Status
}
}
#[derive(Args, Debug)]
pub struct IdleSetArgs {
/// The interval of inactivity after which to disable the screens.
///
/// This can be either a number in minutes and seconds or the keyword `disabled` to
/// disable the screensaver.
///
/// Minutes and seconds can be specified in any of the following formats:
///
/// * 1m
/// * 1m5s
/// * 1m 5s
/// * 1min 5sec
/// * 1 minute 5 seconds
#[clap(verbatim_doc_comment, required = true)]
pub interval: Vec<String>,
}
#[derive(Args, Debug)]
@ -136,5 +183,6 @@ pub fn main() {
Cmd::Quit => quit::main(cli.global),
Cmd::SetLogLevel(a) => set_log_level::main(cli.global, a),
Cmd::Screenshot(a) => screenshot::main(cli.global, a),
Cmd::Idle(a) => idle::main(cli.global, a),
}
}