fix: don't show empty color-slurp windows

This commit is contained in:
Zachary Wander
2023-06-25 11:37:25 +02:00
committed by Louis Pontoise
parent fd2f14ae2e
commit 01b3a428d9
+7 -8
View File
@@ -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)
}