feat: support autocad non-native windows (#3219)

This commit is contained in:
lwouis
2024-03-15 18:18:01 +01:00
parent 7df1432744
commit bbaef6cf8e
2 changed files with 10 additions and 1 deletions
+7 -1
View File
@@ -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)
}
+3
View File
@@ -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