GlazeWM is a tiling window manager for macOS and Windows inspired by i3wm.
fix: correctly set focus on window move to workspace
Lars Berger820384d6b982
diff --git a/packages/wm/src/windows/commands/move_window_to_workspace.rs b/packages/wm/src/windows/commands/move_window_to_workspace.rsindex db006e6a..ea9da1c1 100644--- a/packages/wm/src/windows/commands/move_window_to_workspace.rs+++ b/packages/wm/src/windows/commands/move_window_to_workspace.rs@@ -19,7 +19,7 @@ pub fn move_window_to_workspace(state: &mut WmState,config: &UserConfig,) -> anyhow::Result<()> {- info!("Moving window to workspace: {:?}.", workspace_name);+ info!("Moving window to workspace: '{}'.", workspace_name);let current_workspace = window.workspace().context("No workspace.")?;let current_monitor =@@ -65,14 +65,9 @@ pub fn move_window_to_workspace();}- let focus_target = state.focus_target_after_removal(&window);-- // Since the workspace that gets displayed is the last focused child,- // focus needs to be reassigned to the displayed workspace.- let focus_reset_target = match target_workspace.is_displayed() {- true => None,- false => target_monitor.descendant_focus_order().next(),- };+ let focus_target = state+ .focus_target_after_removal(&window)+ .context("No focus target after window move.")?;let insertion_sibling = target_workspace.descendant_focus_order()@@ -101,15 +96,10 @@ pub fn move_window_to_workspace(}}- if let Some(focus_reset_target) = focus_reset_target {- set_focused_descendant(focus_reset_target, None);- state.pending_sync.focus_change = true;- }-- if let Some(focus_target) = focus_target {- set_focused_descendant(focus_target, None);- state.pending_sync.focus_change = true;- }+ // Since the workspace that gets displayed is the last focused child,+ // focus needs to be reassigned to the displayed workspace.+ set_focused_descendant(focus_target, None);+ state.pending_sync.focus_change = true;match window {WindowContainer::NonTilingWindow(_) => {diff --git a/resources/sample-config.yaml b/resources/sample-config.yamlindex 256a09d1..e8e85746 100644--- a/resources/sample-config.yaml+++ b/resources/sample-config.yaml@@ -8,7 +8,7 @@ general:# Whether to switch back and forth between the previously focused# workspace when focusing the current workspace.- toggle_workspace_on_refocus: true+ toggle_workspace_on_refocus: falsecursor_jump:# Whether to automatically move the cursor on the specified trigger.