Compare commits

..

2 Commits

Author SHA1 Message Date
19d0f8be6a disable then enable 2023-09-22 18:57:34 -04:00
5c1889ef7d TODONE 2023-08-23 13:15:56 +00:00

View File

@@ -27,7 +27,6 @@ fn main() {
let json = json::parse(s).unwrap(); let json = json::parse(s).unwrap();
// TODO I think there is a better alternative syntax to match here.
let json_outputs = let json_outputs =
if let JsonValue::Array(vec) = json { if let JsonValue::Array(vec) = json {
vec vec
@@ -75,21 +74,18 @@ fn main() {
} }
} }
// TODO do all enables then all disables. // TODO if there are no enables do nothing.
// TODO if there are only disables then do nothing. outputs.iter()
for output in &outputs { .for_each(|output| {
match output { if let SwayOutput::Disabled{name} = output {
SwayOutput::Disabled { name } => {
println!("swaymsg output {} disabled", name); println!("swaymsg output {} disabled", name);
// TODO run }
}, });
SwayOutput::Enabled { name, width, height, x, y } => { outputs.iter()
println!( .for_each(|output| {
"swaymsg output {} enable dpms on mode {}x{} pos {} {}", if let SwayOutput::Enabled{name,width,height,x,y} = output {
println!("swaymsg output {} enable dpms on mode {}x{} pos {} {}",
name, width, height, x, y); name, width, height, x, y);
// TODO run
} }
} });
}
} }