fix(wm): hide non-focused windows in containers

This commit ensures that every non-focused index in a Ring<Window> will
be hidden when a new window is added and focused via
Container::add_window, which typically happens when
WindowContainerBehaviour::Append is enabled and a new window is opened.

re #889
This commit is contained in:
LGUG2Z
2024-06-25 14:40:27 -07:00
parent 7b1ece9680
commit 1d0ac9b555
2 changed files with 11 additions and 0 deletions

View File

@@ -116,6 +116,13 @@ impl Container {
pub fn add_window(&mut self, window: Window) {
self.windows_mut().push_back(window);
self.focus_window(self.windows().len().saturating_sub(1));
let focused_window_idx = self.focused_window_idx();
for (i, window) in self.windows().iter().enumerate() {
if i != focused_window_idx {
window.hide();
}
}
}
#[tracing::instrument(skip(self))]

View File

@@ -346,6 +346,8 @@ impl WindowManager {
.ok_or_else(|| anyhow!("there is no focused container"))?
.add_window(window);
self.update_focused_workspace(true, false)?;
stackbar_manager::send_notification();
}
}
}
@@ -546,6 +548,8 @@ impl WindowManager {
)?;
}
}
stackbar_manager::send_notification();
}
}
}