diff --git a/komorebi/src/process_event.rs b/komorebi/src/process_event.rs index 12f146de..5d714117 100644 --- a/komorebi/src/process_event.rs +++ b/komorebi/src/process_event.rs @@ -92,14 +92,7 @@ impl WindowManager { // All event handlers below this point should only be processed if the event is // related to a window that should be managed by the WindowManager. - if !should_manage - && !matches!( - event, - WindowManagerEvent::DisplayChange(_) - | WindowManagerEvent::ForceUpdate(_) - | WindowManagerEvent::FocusChange(_, _) - ) - { + if !should_manage && !matches!(event, WindowManagerEvent::DisplayChange(_)) { return Ok(()); } diff --git a/komorebi/src/stackbar.rs b/komorebi/src/stackbar.rs index eaff1338..33caa7f6 100644 --- a/komorebi/src/stackbar.rs +++ b/komorebi/src/stackbar.rs @@ -55,9 +55,6 @@ use komorebi_core::Rect; use crate::window::Window; use crate::windows_api::WindowsApi; -use crate::winevent::WinEvent; -use crate::winevent_listener; -use crate::WindowManagerEvent; use crate::DEFAULT_CONTAINER_PADDING; use crate::STACKBAR_FOCUSED_TEXT_COLOUR; use crate::STACKBAR_TAB_BACKGROUND_COLOUR; @@ -116,12 +113,9 @@ impl Stackbar { if x >= left && x <= right && y >= top && y <= bottom { let window = Window { hwnd: *win_hwnd }; - let event_sender = winevent_listener::event_tx(); - let _ = event_sender.send(WindowManagerEvent::FocusChange( - WinEvent::ObjectFocus, - window, - )); - let _ = event_sender.send(WindowManagerEvent::ForceUpdate(window)); + if let Err(err) = window.focus(false) { + tracing::error!("Stackbar focus error: HWND:{} {}", *win_hwnd, err); + } } } } diff --git a/komorebi/src/window.rs b/komorebi/src/window.rs index 55b29634..5857ae89 100644 --- a/komorebi/src/window.rs +++ b/komorebi/src/window.rs @@ -315,7 +315,10 @@ impl Window { #[tracing::instrument(fields(exe, title))] pub fn should_manage(self, event: Option) -> Result { - #[allow(clippy::question_mark)] + if !self.is_window() { + return Ok(false); + } + if self.title().is_err() { return Ok(false); }