mirror of
https://github.com/YaLTeR/niri.git
synced 2025-10-05 16:12:47 +02:00
layout: Extract Monitor::into_workspaces()
This commit is contained in:
@@ -814,14 +814,7 @@ impl<W: LayoutElement> Layout<W> {
|
||||
monitor.workspaces[monitor.active_workspace_idx].id(),
|
||||
);
|
||||
|
||||
let mut workspaces = monitor.workspaces;
|
||||
|
||||
for ws in &mut workspaces {
|
||||
ws.set_output(None);
|
||||
}
|
||||
|
||||
// Get rid of empty workspaces.
|
||||
workspaces.retain(|ws| ws.has_windows_or_name());
|
||||
let mut workspaces = monitor.into_workspaces();
|
||||
|
||||
if monitors.is_empty() {
|
||||
// Removed the last monitor.
|
||||
|
@@ -303,6 +303,16 @@ impl<W: LayoutElement> Monitor<W> {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn into_workspaces(mut self) -> Vec<Workspace<W>> {
|
||||
self.workspaces.retain(|ws| ws.has_windows_or_name());
|
||||
|
||||
for ws in &mut self.workspaces {
|
||||
ws.set_output(None);
|
||||
}
|
||||
|
||||
self.workspaces
|
||||
}
|
||||
|
||||
pub fn output(&self) -> &Output {
|
||||
&self.output
|
||||
}
|
||||
|
Reference in New Issue
Block a user