From e0687167b4ea50bf8c06a2c30175457e5d75d3f7 Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Sat, 31 Oct 2026 10:10:39 -0700 Subject: [PATCH] refactor(mac): keep ax_registry in step when a native tab changes a window's id Step 11(ii), third part. BEHAVIOUR (bookkeeping only). The two places in process_event.rs that swap a window's id and element in place when a native tabbed application shows another tab now call ax_registry::sync(old_id, window): the old id is forgotten and the window registered as it now is, so the table never names an element that the model has replaced. No AX call is added. Verified: macOS fake-CC type-check (tools/fast-check) PASS. Not verified: cannot run on Linux. Gate needed: Mac hand check with a tabbed app (Terminal or Finder tabs; see docs/dev/macos-handcheck.md): switch tabs, close the first tab, focus the window by command; behaviour must match the baseline. --- komorebi-for-mac/komorebi/src/process_event.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/komorebi-for-mac/komorebi/src/process_event.rs b/komorebi-for-mac/komorebi/src/process_event.rs index 5467f52f..47f25fb4 100644 --- a/komorebi-for-mac/komorebi/src/process_event.rs +++ b/komorebi-for-mac/komorebi/src/process_event.rs @@ -316,8 +316,10 @@ impl WindowManager { workspace.containers_mut().get_mut(container_idx) && let Some(window) = container.focused_window_mut() { + let old_id = window.id; window.id = window_id; window.element = AccessibilityUiElement(element.clone()); + crate::ax_registry::sync(old_id, window); } // check monocle_container for tabbed applications @@ -349,8 +351,10 @@ impl WindowManager { && let Some(monocle) = workspace.monocle_container.as_mut() && let Some(window) = monocle.focused_window_mut() { + let old_id = window.id; window.id = window_id; window.element = AccessibilityUiElement(element.clone()); + crate::ax_registry::sync(old_id, window); } if first_tab_destroyed {