diff --git a/DockDoor/Utilities/Window Management/WindowUtil.swift b/DockDoor/Utilities/Window Management/WindowUtil.swift index 1132e21..76b2cd0 100644 --- a/DockDoor/Utilities/Window Management/WindowUtil.swift +++ b/DockDoor/Utilities/Window Management/WindowUtil.swift @@ -320,15 +320,13 @@ enum WindowUtil { return } let appElement = AXUIElementCreateApplication(app.processIdentifier) - if let windows = try? appElement.windows() { - for window in windows { - if let cgWindowId = try? window.cgWindowId(), let index = windowSet.firstIndex(where: { $0.id == cgWindowId }) { - var updatedWindow = windowSet[index] - updatedWindow.date = Date() - windowSet.remove(at: index) - windowSet.insert(updatedWindow) - return - } + if let window = try? appElement.focusedWindow() { + if let cgWindowId = try? window.cgWindowId(), let index = windowSet.firstIndex(where: { $0.id == cgWindowId }) { + var updatedWindow = windowSet[index] + updatedWindow.date = Date() + windowSet.remove(at: index) + windowSet.insert(updatedWindow) + return } } }