diff --git a/komorebi-for-mac/komorebi/src/macos_backend.rs b/komorebi-for-mac/komorebi/src/macos_backend.rs index 4811c567..3bef4cd4 100644 --- a/komorebi-for-mac/komorebi/src/macos_backend.rs +++ b/komorebi-for-mac/komorebi/src/macos_backend.rs @@ -118,7 +118,7 @@ impl MacosBackend { window: &Window, error: impl std::error::Error + Send + Sync + 'static, ) -> Error { - if window.is_valid() { + if window.alive() { platform(error) } else { Error::WindowGone(id) @@ -126,7 +126,7 @@ impl MacosBackend { } fn info(window: &Window) -> Option { - if !window.is_valid() { + if !window.alive() { return None; } diff --git a/komorebi-for-mac/komorebi/src/reaper.rs b/komorebi-for-mac/komorebi/src/reaper.rs index 8f88b0c9..9f06b359 100644 --- a/komorebi-for-mac/komorebi/src/reaper.rs +++ b/komorebi-for-mac/komorebi/src/reaper.rs @@ -64,7 +64,7 @@ fn handle_notifications(wm: Arc>) -> color_eyre::Result<()> continue 'notification; } - handle_notification(&mut wm, notification, Window::is_valid)?; + handle_notification(&mut wm, notification, Window::alive)?; } Ok(()) diff --git a/komorebi-for-mac/komorebi/src/window.rs b/komorebi-for-mac/komorebi/src/window.rs index 49c0fe4d..de2ce50b 100644 --- a/komorebi-for-mac/komorebi/src/window.rs +++ b/komorebi-for-mac/komorebi/src/window.rs @@ -465,7 +465,7 @@ impl Drop for Window { fn drop(&mut self) { // this gets called when a cloned Window is dropped, so we need to make sure it only // invalidates the observer if the Window is no longer open - if !self.is_valid() { + if !self.alive() { tracing::info!( "invalidating window observer for {}", self.title() @@ -574,7 +574,7 @@ impl Window { MacosApi::window_rect(&self.element) } - pub fn is_valid(&self) -> bool { + pub fn alive(&self) -> bool { AccessibilityApi::copy_attribute_names(&self.element).is_some() } @@ -1290,7 +1290,7 @@ impl Window { event: Option, debug: &mut RuleDebug, ) -> eyre::Result { - if !self.is_valid() { + if !self.alive() { return Ok(false); } diff --git a/komorebi-for-mac/komorebi/src/workspace.rs b/komorebi-for-mac/komorebi/src/workspace.rs index d6d29ab7..a66674d1 100644 --- a/komorebi-for-mac/komorebi/src/workspace.rs +++ b/komorebi-for-mac/komorebi/src/workspace.rs @@ -566,7 +566,7 @@ impl Workspace { // if accessibility API calls fail on AXError::InvalidUIElement // let's try and nuke these early - if !focused_window.is_valid() { + if !focused_window.alive() { invalid_window_ids.push(focused_window.id); } } @@ -591,7 +591,7 @@ impl Workspace { // if accessibility API calls fail on AXError::InvalidUIElement // let's try and nuke these early - if !focused_window.is_valid() { + if !focused_window.alive() { invalid_window_ids.push(focused_window.id); } } @@ -612,7 +612,7 @@ impl Workspace { // if accessibility API calls fail on AXError::InvalidUIElement // let's try and nuke these early - if !window.is_valid() { + if !window.alive() { invalid_floating_window_ids.push(window.id); } }