Anime: expose new options in CLI

This commit is contained in:
Luke D. Jones
2023-11-15 17:45:25 +13:00
parent e470d3acc0
commit e88e7be8ae
4 changed files with 40 additions and 7 deletions

View File

@@ -19,6 +19,26 @@ pub struct AnimeCommand {
pub brightness: Option<Brightness>,
#[options(help = "clear the display")]
pub clear: bool,
#[options(
no_short,
meta = "",
help = "turn the anime off when external power is unplugged"
)]
pub off_when_unplugged: Option<bool>,
#[options(
no_short,
meta = "",
help = "turn the anime off when the laptop suspends"
)]
pub off_when_suspended: Option<bool>,
#[options(
no_short,
meta = "",
help = "turn the anime off when the lid is closed"
)]
pub off_when_lid_closed: Option<bool>,
#[options(no_short, meta = "", help = "Off with his head!!!")]
pub off_with_his_head: Option<bool>,
#[options(command)]
pub command: Option<AnimeActions>,
}

View File

@@ -207,6 +207,10 @@ fn handle_anime(
&& cmd.enable_display.is_none()
&& cmd.enable_powersave_anim.is_none()
&& cmd.brightness.is_none()
&& cmd.off_when_lid_closed.is_none()
&& cmd.off_when_suspended.is_none()
&& cmd.off_when_unplugged.is_none()
&& cmd.off_with_his_head.is_none()
&& !cmd.clear)
|| cmd.help
{
@@ -225,6 +229,18 @@ fn handle_anime(
if let Some(bright) = cmd.brightness {
dbus.proxies().anime().set_brightness(bright)?;
}
if let Some(enable) = cmd.off_when_lid_closed {
dbus.proxies().anime().set_off_when_lid_closed(enable)?;
}
if let Some(enable) = cmd.off_when_suspended {
dbus.proxies().anime().set_off_when_suspended(enable)?;
}
if let Some(enable) = cmd.off_when_unplugged {
dbus.proxies().anime().set_off_when_unplugged(enable)?;
}
if cmd.off_with_his_head.is_some() {
println!("Did Alice _really_ make it back from Wonderland?");
}
let mut anime_type = get_anime_type()?;
if let AnimeType::Unknown = anime_type {