From 19d0f8be6a721409e8461f8aa206827aaa05f65f Mon Sep 17 00:00:00 2001 From: stephen Date: Fri, 22 Sep 2023 18:57:34 -0400 Subject: [PATCH] disable then enable --- src/main.rs | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/src/main.rs b/src/main.rs index d793495..958e624 100644 --- a/src/main.rs +++ b/src/main.rs @@ -74,21 +74,18 @@ fn main() { } } - // TODO do all enables then all disables. - // TODO if there are only disables then do nothing. - for output in &outputs { - match output { - SwayOutput::Disabled { name } => { + // TODO if there are no enables do nothing. + outputs.iter() + .for_each(|output| { + if let SwayOutput::Disabled{name} = output { println!("swaymsg output {} disabled", name); - // TODO run - }, - SwayOutput::Enabled { name, width, height, x, y } => { - println!( - "swaymsg output {} enable dpms on mode {}x{} pos {} {}", - name, width, height, x, y); - // TODO run } - } - } - -} + }); + outputs.iter() + .for_each(|output| { + if let SwayOutput::Enabled{name,width,height,x,y} = output { + println!("swaymsg output {} enable dpms on mode {}x{} pos {} {}", + name, width, height, x, y); + } + }); +} \ No newline at end of file