mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-03-27 03:41:16 +01:00
fix(wm): focus when switching to ws with only floating windows
This commit ensures that if a user switches from a workspace with managed windows to a workspace without any managed windows but only floating windows, the focused window from the previous workspace will lose focus as it should, and the first floating window on the new workspace will gain focus as it should.
This commit is contained in:
@@ -1387,6 +1387,17 @@ impl WindowManager {
|
||||
window.focus(self.mouse_follows_focus)?;
|
||||
}
|
||||
}
|
||||
|
||||
// This is to correctly remove focus from the previous when changing focused workspace
|
||||
// to a workspace which only contains floating windows and no other kind of managed window
|
||||
if self.focused_workspace()?.containers().is_empty()
|
||||
&& self.focused_workspace()?.monocle_container().is_none()
|
||||
&& self.focused_workspace()?.maximized_window().is_none()
|
||||
{
|
||||
if let Some(window) = self.focused_workspace()?.floating_windows().first() {
|
||||
window.focus(self.mouse_follows_focus)?;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user