Skip to content

Commit

Permalink
fix(wm): ensure focus restore on float + max hwnds
Browse files Browse the repository at this point in the history
This commit ensures that when switching to a workspace which contains a
floating window or a maximized window, either the maximized window or
the first floating window index will be focused.

This is to prevent windows which have been hidden on the previous
workspace from retaining keyboard focus.

fix #1130
  • Loading branch information
LGUG2Z committed Nov 20, 2024
1 parent 219fa8e commit d001d8a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions komorebi/src/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,10 @@ impl Workspace {
if let Some(window) = to_focus {
if self.maximized_window().is_none() && self.floating_windows().is_empty() {
window.focus(mouse_follows_focus)?;
} else if let Some(maximized_window) = self.maximized_window() {
maximized_window.focus(mouse_follows_focus)?;
} else if let Some(floating_window) = self.floating_windows().first() {
floating_window.focus(mouse_follows_focus)?;
}
}

Expand Down

0 comments on commit d001d8a

Please sign in to comment.