fix(wm): update focused idx on cross-monitor moves

This commit ensures that in situations where the last container on a
monitor is moved to an adjacent monitor, the focused container index of
the origin monitor will be appropriately decremented.
This commit is contained in:
LGUG2Z
2024-05-11 16:47:42 -07:00
parent c47cf4718b
commit 1b30561989
2 changed files with 3 additions and 1 deletions

View File

@@ -1366,6 +1366,8 @@ impl WindowManager {
anyhow!("could not remove container at given origin index")
})?;
self.focused_workspace_mut()?.focus_previous_container();
// focus the target monitor
self.focus_monitor(target_monitor_idx)?;

View File

@@ -1376,7 +1376,7 @@ impl Workspace {
vec
}
fn focus_previous_container(&mut self) {
pub fn focus_previous_container(&mut self) {
let focused_idx = self.focused_container_idx();
if focused_idx != 0 {