Skip to content

Commit

Permalink
toplevel-management: Make move_to_workspace work with minimized window
Browse files Browse the repository at this point in the history
Iterating over `.windows()` for each workspace does not iterate over
`minimized_windows`, so `from_workspace` was not found. Simply changing
this to use `element_for_surface` and `space_for` (like `fullscreen` and
`unfullscreen`) fixes this.

Addresses pop-os/cosmic-workspaces-epoch#89.
Though it does unminimize the window, which we may also want to change.
  • Loading branch information
ids1024 committed Jan 28, 2025
1 parent 7822030 commit 9b3a42d
Showing 1 changed file with 17 additions and 26 deletions.
43 changes: 17 additions & 26 deletions src/wayland/handlers/toplevel_management.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,33 +109,24 @@ impl ToplevelManagementHandler for State {
};

let mut shell = self.common.shell.write().unwrap();
let from_workspace = shell.workspaces.spaces().find(|w| {
w.mapped()
.flat_map(|m| m.windows().map(|(s, _)| s))
.any(|w| &w == window)
});
if let Some(from_workspace) = from_workspace {
let mapped = from_workspace
.mapped()
.find(|m| m.windows().any(|(w, _)| &w == window))
.unwrap()
.clone();
let from_handle = from_workspace.handle;
let seat = shell.seats.last_active().clone();
let res = shell.move_window(
Some(&seat),
&mapped,
&from_handle,
&to_handle,
false,
None,
&mut self.common.workspace_state.update(),
);
if let Some((target, _)) = res {
std::mem::drop(shell);
Shell::set_focus(self, Some(&target), &seat, None, true);
if let Some(mapped) = shell.element_for_surface(window).cloned() {
if let Some(from_workspace) = shell.space_for(&mapped) {
let from_handle = from_workspace.handle;
let seat = shell.seats.last_active().clone();
let res = shell.move_window(
Some(&seat),
&mapped,
&from_handle,
&to_handle,
false,
None,
&mut self.common.workspace_state.update(),
);
if let Some((target, _)) = res {
std::mem::drop(shell);
Shell::set_focus(self, Some(&target), &seat, None, true);
}
}
return;
}
}

Expand Down

0 comments on commit 9b3a42d

Please sign in to comment.