Skip to content

Commit

Permalink
fix(wm): avoid workspace load on command move across monitor
Browse files Browse the repository at this point in the history
If the move happens between the already focused workspaces of two
monitors we shouldn't load the workspace, since it is already loaded and
it will cause changes on focused windows, which might result on the
window we just moved not being focused.
  • Loading branch information
alex-ds13 committed Nov 28, 2024
1 parent 4bf24f8 commit cb53f46
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions komorebi/src/window_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1437,8 +1437,12 @@ impl WindowManager {
.get_mut(monitor_idx)
.ok_or_else(|| anyhow!("there is no monitor"))?;

let mut should_load_workspace = false;
if let Some(workspace_idx) = workspace_idx {
target_monitor.focus_workspace(workspace_idx)?;
if workspace_idx != target_monitor.focused_workspace_idx() {
target_monitor.focus_workspace(workspace_idx)?;
should_load_workspace = true;
}
}
let target_workspace = target_monitor
.focused_workspace_mut()
Expand Down Expand Up @@ -1469,7 +1473,9 @@ impl WindowManager {
bail!("failed to find a window to move");
}

target_monitor.load_focused_workspace(mouse_follows_focus)?;
if should_load_workspace {
target_monitor.load_focused_workspace(mouse_follows_focus)?;
}
target_monitor.update_focused_workspace(offset)?;

// this second one is for DPI changes when the target is another monitor
Expand Down

0 comments on commit cb53f46

Please sign in to comment.