mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-16 05:41:16 +01:00
fix(wm): allow closed windows to be reaped
Instead of erroring out when a window position can't be set due to the AXUIElement no longer existing, log a warning and let the invalid application window reaper clean it up.
This commit is contained in:
1 parent
8eb01713f2
commit
63d3b4e33a
2 files changed
+16
-6
No files matched your search
@@ -656,8 +656,16 @@ impl WindowManager {
|
||||
}
|
||||
}
|
||||
|
||||
let mut reaped_count = 0;
|
||||
|
||||
let focused_workspace = self.focused_workspace_mut()?;
|
||||
focused_workspace.reap_invalid_windows_for_application(process_id, &valid_window_ids)?;
|
||||
reaped_count += focused_workspace
|
||||
.reap_invalid_windows_for_application(process_id, &valid_window_ids)?;
|
||||
|
||||
if reaped_count > 0 {
|
||||
tracing::debug!("reaped {reaped_count} invalid window(s)");
|
||||
}
|
||||
|
||||
self.update_focused_workspace(false, false)
|
||||
}
|
||||
|
||||
|
||||
@@ -222,7 +222,7 @@ impl Workspace {
|
||||
&mut self,
|
||||
process_id: i32,
|
||||
valid_window_ids: &[u32],
|
||||
) -> eyre::Result<()> {
|
||||
) -> eyre::Result<usize> {
|
||||
let mut invalid_window_ids = vec![];
|
||||
for container in self.containers() {
|
||||
if let Some(focused_window) = container.focused_window()
|
||||
@@ -233,11 +233,11 @@ impl Workspace {
|
||||
}
|
||||
}
|
||||
|
||||
for window_id in invalid_window_ids {
|
||||
self.remove_window(window_id)?;
|
||||
for window_id in &invalid_window_ids {
|
||||
self.remove_window(*window_id)?;
|
||||
}
|
||||
|
||||
Ok(())
|
||||
Ok(invalid_window_ids.len())
|
||||
}
|
||||
|
||||
pub fn remove_window(&mut self, window_id: u32) -> eyre::Result<Window> {
|
||||
@@ -808,7 +808,9 @@ impl Workspace {
|
||||
layout.add_padding(border_width);
|
||||
|
||||
for window in container.windows() {
|
||||
window.set_position(layout)?;
|
||||
if let Err(error) = window.set_position(layout) {
|
||||
tracing::warn!("failed to set window position: {error}")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user