diff --git a/komorebi/src/process_command.rs b/komorebi/src/process_command.rs index 09f85696..12081758 100644 --- a/komorebi/src/process_command.rs +++ b/komorebi/src/process_command.rs @@ -1389,10 +1389,14 @@ impl WindowManager { ); } - let stack = BORDER_COLOUR_STACK.load(Ordering::SeqCst); - if stack != 0 && self.focused_container()?.windows().len() > 1 { - BORDER_COLOUR_CURRENT - .store(stack, Ordering::SeqCst); + // it is not acceptable to fail here; we need to be able to send the event to + // subscribers + if self.focused_container().is_ok() { + let stack = BORDER_COLOUR_STACK.load(Ordering::SeqCst); + if stack != 0 && self.focused_container()?.windows().len() > 1 { + BORDER_COLOUR_CURRENT + .store(stack, Ordering::SeqCst); + } } let border = Border::from(BORDER_HWND.load(Ordering::SeqCst)); diff --git a/komorebi/src/window_manager.rs b/komorebi/src/window_manager.rs index 72b4e508..0f0a2879 100644 --- a/komorebi/src/window_manager.rs +++ b/komorebi/src/window_manager.rs @@ -852,17 +852,18 @@ impl WindowManager { } } - // if we passed false for follow_focus - if !follow_focus + // if we passed false for follow_focus and there is a container on the workspace + if !follow_focus && self.focused_container_mut().is_ok() { // and we have a stack with >1 windows - && self.focused_container_mut()?.windows().len() > 1 + if self.focused_container_mut()?.windows().len() > 1 // and we don't have a maxed window && self.focused_workspace()?.maximized_window().is_none() // and we don't have a monocle container && self.focused_workspace()?.monocle_container().is_none() - { - if let Ok(window) = self.focused_window_mut() { - window.focus(self.mouse_follows_focus)?; + { + if let Ok(window) = self.focused_window_mut() { + window.focus(self.mouse_follows_focus)?; + } } };