Skip to content

Commit

Permalink
fix(wm): ensure moves to floating workspaces
Browse files Browse the repository at this point in the history
This commit ensures that windows moved to a floating workspace on a
different monitor will have their positions updated accordingly for the
target monitor. Since floating layouts have no layout algorithm applied,
the moved window will be centered in the work_area of the target monitor
in the target workspace.

fix #865
  • Loading branch information
LGUG2Z committed Jun 4, 2024
1 parent a488890 commit 280aebf
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions komorebi/src/window_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1070,6 +1070,12 @@ impl WindowManager {
.remove_focused_container()
.ok_or_else(|| anyhow!("there is no container"))?;

let container_hwnds = container
.windows()
.iter()
.map(|w| w.hwnd)
.collect::<Vec<_>>();

monitor.update_focused_workspace(offset)?;

let target_monitor = self
Expand All @@ -1083,6 +1089,14 @@ impl WindowManager {
target_monitor.focus_workspace(workspace_idx)?;
}

if let Some(workspace) = target_monitor.focused_workspace() {
if !*workspace.tile() {
for hwnd in container_hwnds {
Window::from(hwnd).center(target_monitor.work_area_size())?;
}
}
}

target_monitor.load_focused_workspace(mouse_follows_focus)?;
target_monitor.update_focused_workspace(offset)?;

Expand Down

0 comments on commit 280aebf

Please sign in to comment.