Skip to content

Commit b0963c3

Browse files
committed
fix(wm): prevent focus change event infinite loops
This commit stops the `FocusChange` event from focusing a floating window which is the one emitting said `FocusChange` event, since that is not needed and is the cause of some flicker bugs reported! If that floating window was the one emitting the `FocusChange` event then it means it is already the foreground window, there is no reason for us to focus the window again (since that will create an infinite loop of events). When the window emitting this event is not floating we don't try to focus the window, we simply set the focus index for the container of that window and the focused index for the window of that container. Except on one case, which is if the workspace has a monocle container, then it does focus a window, it focus the monocle window to make sure the monocle keeps showing in front of everything and doesn't let anything come in front of it.
1 parent 990a339 commit b0963c3

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

komorebi/src/process_event.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,7 @@ impl WindowManager {
285285
workspace.set_layer(WorkspaceLayer::Tiling);
286286
}
287287
Some(idx) => {
288-
if let Some(window) = workspace.floating_windows().get(idx) {
289-
window.focus(false)?;
288+
if let Some(_window) = workspace.floating_windows().get(idx) {
290289
workspace.set_layer(WorkspaceLayer::Floating);
291290
}
292291
}

0 commit comments

Comments
 (0)