diff --git a/komorebi/src/window_manager.rs b/komorebi/src/window_manager.rs index 4631ea7c..949434df 100644 --- a/komorebi/src/window_manager.rs +++ b/komorebi/src/window_manager.rs @@ -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) { diff --git a/komorebi/src/workspace.rs b/komorebi/src/workspace.rs index a7392159..18f1d5e1 100644 --- a/komorebi/src/workspace.rs +++ b/komorebi/src/workspace.rs @@ -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) {