diff --git a/src/api-wrappers/AXUIElement.swift b/src/api-wrappers/AXUIElement.swift index 3a177cc5..5da0ce46 100644 --- a/src/api-wrappers/AXUIElement.swift +++ b/src/api-wrappers/AXUIElement.swift @@ -106,7 +106,8 @@ extension AXUIElement { sanGuoShaAirWD(runningApp) || dvdFab(runningApp) || drBetotte(runningApp) || - androidEmulator(runningApp, title) + androidEmulator(runningApp, title) || + autocad(runningApp, subrole) ) && ( mustHaveIfJetbrainApp(runningApp, title, subrole, size!) && mustHaveIfSteam(runningApp, title, role) && @@ -225,6 +226,11 @@ extension AXUIElement { return runningApp.localizedName == "scrcpy" && level == CGWindow.floatingWindow && role == kAXWindowRole && subrole == kAXStandardWindowSubrole } + private static func autocad(_ runningApp: NSRunningApplication, _ subrole: String?) -> Bool { + // AutoCAD uses the undocumented "AXDocumentWindow" subrole + return (runningApp.bundleIdentifier?.hasPrefix("com.autodesk.AutoCAD") ?? false) && subrole == kAXDocumentWindowSubrole + } + func position() throws -> CGPoint? { return try value(kAXPositionAttribute, CGPoint.zero, .cgPoint) } diff --git a/src/api-wrappers/PrivateApis.swift b/src/api-wrappers/PrivateApis.swift index f822a6d1..4b73aabb 100644 --- a/src/api-wrappers/PrivateApis.swift +++ b/src/api-wrappers/PrivateApis.swift @@ -204,6 +204,9 @@ func SLSRequestScreenCaptureAccess() -> UInt8 let kAXFullscreenAttribute = "AXFullScreen" let kAXStatusLabelAttribute = "AXStatusLabel" +// for some reason, these attributes are missing from AXRoleConstants +let kAXDocumentWindowSubrole = "AXDocumentWindow" + enum CGSSymbolicHotKey: Int, CaseIterable { case commandTab = 1 case commandShiftTab = 2