From abdef614fbb746da4b50705b0168869040b2ab40 Mon Sep 17 00:00:00 2001 From: Christoffer Winterkvist Date: Wed, 23 Oct 2024 21:18:18 +0200 Subject: [PATCH] Fix bug when trying to resolve the active window in `SystemWindowRelativeFocus` --- .../Core/Runners/System/SystemWindowRelativeFocus.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/App/Sources/Core/Runners/System/SystemWindowRelativeFocus.swift b/App/Sources/Core/Runners/System/SystemWindowRelativeFocus.swift index 339ba53c..ae004102 100644 --- a/App/Sources/Core/Runners/System/SystemWindowRelativeFocus.swift +++ b/App/Sources/Core/Runners/System/SystemWindowRelativeFocus.swift @@ -35,8 +35,9 @@ final class SystemWindowRelativeFocus { } let windows = indexWindowsInStage(getWindows()) + let activeProcessIdentifier = Int(snapshot.frontmostApplication.ref.processIdentifier) - guard let activeWindow = windows.first else { return } + guard let activeWindow = windows.first(where: { $0.ownerPid == activeProcessIdentifier }) else { return } let previousWindow = activeWindow let match = try await navigation.findNextWindow(activeWindow, windows: windows, direction: direction)