input/actions: Change active workspace / output when migrated

Without this, a workspace moved with the key binding seems to disappear.
This seems more consistent with the behavior of other key bindings.
This commit is contained in:
Ian Douglas Scott 2025-07-09 09:42:31 -07:00 committed by Victoria Brekenfeld
parent 8aa501c0e0
commit 3debae2495
2 changed files with 37 additions and 17 deletions

View file

@ -669,8 +669,41 @@ impl State {
};
if let Some(next_output) = next_output {
self.common
.migrate_workspace(&active_output, &next_output, &active);
let mut shell = self.common.shell.write();
let mut workspace_state = self.common.workspace_state.update();
shell.workspaces.migrate_workspace(
&active_output,
&next_output,
&active,
&mut workspace_state,
);
// Activate workspace on new set, and set that output as active
if let Some(new_idx) = shell
.workspaces
.sets
.get(&next_output)
.and_then(|set| set.workspaces.iter().position(|w| w.handle == active))
{
let res = shell.activate(
&next_output,
new_idx,
WorkspaceDelta::new_shortcut(),
&mut workspace_state,
);
drop(workspace_state);
drop(shell);
if res.is_ok() {
self.handle_shortcut_action(
Action::SwitchOutput(direction),
seat,
serial,
time,
pattern,
Some(direction),
true,
)
}
}
}
}