mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-03-18 23:44:00 +01:00
fix(wm): check exhaustively for ws emptiness
This commit creates a new function for the workspaces to check if they are empty or not. This function properly accounts for maximized windows, monocle windows and floating windows. This should fix the cases where the WM was checking if the workspace was empty to focus the desktop in order to loose focus from previously focused window. Previously it wasn't checking for floating windows so it cause continues focus flickering when there were only floating windows on the workspace.
This commit is contained in:
@@ -852,7 +852,7 @@ impl WindowManager {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if self.focused_workspace()?.containers().is_empty() {
|
||||
if self.focused_workspace()?.is_empty() {
|
||||
let desktop_window = Window::from(WindowsApi::desktop_window()?);
|
||||
|
||||
match WindowsApi::raise_and_focus_window(desktop_window.hwnd) {
|
||||
|
||||
@@ -597,6 +597,13 @@ impl Workspace {
|
||||
Ok(false)
|
||||
}
|
||||
|
||||
pub fn is_empty(&self) -> bool {
|
||||
self.containers().is_empty()
|
||||
&& self.maximized_window().is_none()
|
||||
&& self.monocle_container().is_none()
|
||||
&& self.floating_windows().is_empty()
|
||||
}
|
||||
|
||||
pub fn contains_window(&self, hwnd: isize) -> bool {
|
||||
for container in self.containers() {
|
||||
if container.contains_window(hwnd) {
|
||||
|
||||
Reference in New Issue
Block a user