From 9e1088793348755bb3e0460c2087984f111cd749 Mon Sep 17 00:00:00 2001 From: "indent[bot]" <216979840+indent[bot]@users.noreply.github.com> Date: Sun, 24 May 2026 08:43:43 +0000 Subject: [PATCH] Use .onScreen window list for detached emoji popover lookup The retry loop around characterPickerSearchField was enumerating every window owned by every app on the system (.all) up to 20 times per setReaction. Switching to .onScreen lets CG drop off-screen windows before they cross into Swift land, and isCandidateWindow already required isOnscreen == true so semantics are preserved. Generated with [Indent](https://indent.com) Co-Authored-By: KishanBagaria --- .../Sources/IMessage/Messages/MessagesAppElements.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/IMessage/Sources/IMessage/Messages/MessagesAppElements.swift b/src/IMessage/Sources/IMessage/Messages/MessagesAppElements.swift index d8a67eb1..6c196f1a 100644 --- a/src/IMessage/Sources/IMessage/Messages/MessagesAppElements.swift +++ b/src/IMessage/Sources/IMessage/Messages/MessagesAppElements.swift @@ -52,7 +52,8 @@ private struct CharacterPickerPopover { } private func windowCandidates() throws -> [Window.Description] { - try Window.listDescriptions(.all, excludeDesktopElements: true) + // `.onScreen` lets CG skip off-screen windows up front; `isCandidateWindow` still requires `isOnscreen == true`. + try Window.listDescriptions(.onScreen, excludeDesktopElements: true) .filter(isCandidateWindow) .sorted { score($0) < score($1) } }