diff --git a/src/api-wrappers/AXUIElement.swift b/src/api-wrappers/AXUIElement.swift index 5d234e2d..c94f5b6a 100644 --- a/src/api-wrappers/AXUIElement.swift +++ b/src/api-wrappers/AXUIElement.swift @@ -87,7 +87,7 @@ extension AXUIElement { ( books(runningApp) || keynote(runningApp) || - preview(runningApp) || + preview(runningApp, subrole) || iina(runningApp) || openFlStudio(runningApp, title) || crossoverWindow(runningApp, role, subrole, level) || @@ -144,10 +144,10 @@ extension AXUIElement { return runningApp.bundleIdentifier == "com.apple.iWork.Keynote" } - private static func preview(_ runningApp: NSRunningApplication) -> Bool { + private static func preview(_ runningApp: NSRunningApplication, _ subrole: String?) -> Bool { // when opening multiple documents at once with apple Preview, // one of the window will have level == 1 for some reason - return runningApp.bundleIdentifier == "com.apple.Preview" + return runningApp.bundleIdentifier == "com.apple.Preview" && [kAXStandardWindowSubrole, kAXDialogSubrole].contains(subrole) } private static func openFlStudio(_ runningApp: NSRunningApplication, _ title: String?) -> Bool {