diff options
Diffstat (limited to 'src/layout/mod.rs')
| -rw-r--r-- | src/layout/mod.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/layout/mod.rs b/src/layout/mod.rs index 67b1b139..bedc0979 100644 --- a/src/layout/mod.rs +++ b/src/layout/mod.rs @@ -776,6 +776,27 @@ impl<W: LayoutElement> Layout<W> { mon.workspaces.iter().flat_map(|ws| ws.windows()) } + pub fn with_windows(&self, mut f: impl FnMut(&W, Option<&Output>)) { + match &self.monitor_set { + MonitorSet::Normal { monitors, .. } => { + for mon in monitors { + for ws in &mon.workspaces { + for win in ws.windows() { + f(win, Some(&mon.output)); + } + } + } + } + MonitorSet::NoOutputs { workspaces } => { + for ws in workspaces { + for win in ws.windows() { + f(win, None); + } + } + } + } + } + fn active_monitor(&mut self) -> Option<&mut Monitor<W>> { let MonitorSet::Normal { monitors, |
