fix: only show standard windows of preview.app (closes #3351)

This commit is contained in:
lwouis
2024-05-12 22:03:12 +02:00
parent 758b3e804e
commit 6231977e70
+3 -3
View File
@@ -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 {