From ecaa3e15160566ab9b6f28e2046fe95defa12b77 Mon Sep 17 00:00:00 2001 From: LGUG2Z Date: Sat, 31 Oct 2026 10:00:34 -0700 Subject: [PATCH] refactor(mac): give Window a close operation Adds Window::close (Backend::close): the same press of the close button that AdhocWindow::close does on a bare element, applied to the Window's element. Nothing calls it yet; MacosBackend switches to it in the next step. No behaviour change: the daemon's own close command still goes through AdhocWindow on the foreground element, because it has no Window there. Verified: macOS fake-CC type-check (tools/fast-check) PASS. Not verified: cannot run or unit-test on Linux. --- komorebi-for-mac/komorebi/src/window.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/komorebi-for-mac/komorebi/src/window.rs b/komorebi-for-mac/komorebi/src/window.rs index 51aabbad..3ea82eab 100644 --- a/komorebi-for-mac/komorebi/src/window.rs +++ b/komorebi-for-mac/komorebi/src/window.rs @@ -814,6 +814,11 @@ impl Window { AccessibilityApi::set_attribute_cf_value(&self.element, kAXMinimizedAttribute, value) } + /// Closes the window by pressing its close button (`Backend::close`); `Ok` when it has none. + pub fn close(&self) -> Result<(), AccessibilityError> { + AdhocWindow::close(&self.element.0) + } + #[tracing::instrument(skip_all)] pub fn restore(&mut self) -> Result<(), AccessibilityError> { // waiting for what is on its way to the window is not something to do with a lock held