diff --git a/src/api-wrappers/AXUIElement.swift b/src/api-wrappers/AXUIElement.swift index 239e888d..fe34018f 100644 --- a/src/api-wrappers/AXUIElement.swift +++ b/src/api-wrappers/AXUIElement.swift @@ -99,11 +99,11 @@ extension AXUIElement { sanGuoShaAirWD(runningApp) || dvdFab(runningApp) || drBetotte(runningApp) || - androidEmulator(runningApp, title) || - colorSlurp(runningApp) + androidEmulator(runningApp, title) ) && mustHaveIfJetbrainApp(runningApp, title, subrole, size!) && - mustHaveIfSteam(runningApp, title, role) + mustHaveIfSteam(runningApp, title, role) && + mustHaveIfColorSlurp(runningApp, title, subrole) )) } @@ -117,6 +117,10 @@ extension AXUIElement { ) } + private static func mustHaveIfColorSlurp(_ runningApp: NSRunningApplication, _ title: String?, _ subrole: String?) -> Bool { + return runningApp.bundleIdentifier != "com.IdeaPunch.ColorSlurp" || subrole == kAXStandardWindowSubrole + } + private static func iina(_ runningApp: NSRunningApplication) -> Bool { // IINA.app can have videos float (level == 2 instead of 0) // there is also complex animations during which we may or may not consider the window not a window @@ -201,11 +205,6 @@ extension AXUIElement { return title != "" && Applications.isAndroidEmulator(runningApp) } - private static func colorSlurp(_ runningApp: NSRunningApplication) -> Bool { - // ColorSlurp presents its dialog as a kAXSystemDialogSubrole, so we need a special check - return runningApp.bundleIdentifier == "com.IdeaPunch.ColorSlurp" - } - func position() throws -> CGPoint? { return try value(kAXPositionAttribute, CGPoint.zero, .cgPoint) }