Commit 140b53f6ef84
tarball2 files changed+17-0
@@ -102,6 +102,12 @@ pub enum Command {
102102
Dismiss {103103
name: Option<String>,104104
},105
+ /// Switches outputs on or off, all of them without a name.106
+ Power {107
+ on: bool,108
+ #[serde(default)]109
+ output: Option<String>,110
+ },105111
}106112
107113
#[derive(Debug, Clone, PartialEq, Eq)]@@ -208,6 +214,16 @@ impl Command {
208214
_ => return Err(err("takes at most one name")),209215
},210216
},217
+ "power" => {218
+ let (on, output) = match args {219
+ ["on"] => (true, None),220
+ ["off"] => (false, None),221
+ ["on", o] => (true, Some(o.to_string())),222
+ ["off", o] => (false, Some(o.to_string())),223
+ _ => return Err(err("takes on or off and optionally an output")),224
+ };225
+ Command::Power { on, output }226
+ }211227
_ => return Err(ParseError(format!("unknown command {name}"))),212228
})213229
}@@ -156,6 +156,7 @@ impl State {
156156
self.wm.layout.summon(&name);157157
}158158
Command::Dismiss { name } => self.wm.layout.dismiss(name.as_deref()),159
+ Command::Power { on, output } => self.set_output_power(output.as_deref(), on)?,159160
}160161
self.apply_layout();161162
Ok(())