Skip to content

Commit

Permalink
fix(wm): update focused idx on cross-monitor moves
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
LGUG2Z committed May 11, 2024
1 parent c47cf47 commit 1b30561
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions komorebi/src/window_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?;

Expand Down
2 changes: 1 addition & 1 deletion komorebi/src/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 1b30561

Please sign in to comment.