Skip to content

Commit d610c05

Browse files
committed
Fix compile error: AXError has no .notTrusted member
The AXError C enum does not define kAXErrorNotTrusted — the enum jumps directly from kAXErrorAPIDisabled (-25211) to kAXErrorNoValue (-25212). Removing the non-existent check; kAXErrorAPIDisabled alone correctly identifies the "process not trusted" case. https://claude.ai/code/session_01SLK18VAKHQdk37Mubvyp47
1 parent dc0dd92 commit d610c05

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

Sources/HeardCore/Services.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1343,15 +1343,16 @@ public final class PermissionCenter: ObservableObject {
13431343
private func accessibilityState() -> PermissionState {
13441344
if AXIsProcessTrusted() { return .granted }
13451345
// AXIsProcessTrusted can return stale TCC data on macOS 15+. Confirm with a
1346-
// live AX API call: only kAXErrorAPIDisabled / kAXErrorNotTrusted mean "no
1347-
// permission" — all other results (including kAXErrorNoValue for "no focused
1348-
// app") mean the process IS trusted.
1346+
// live AX API call: only kAXErrorAPIDisabled means "no permission" — all other
1347+
// results (including kAXErrorNoValue for "no focused app") mean the process IS
1348+
// trusted. Note: AXError has no .notTrusted member; the enum jumps directly
1349+
// from .apiDisabled to .noValue.
13491350
let sysWide = AXUIElementCreateSystemWide()
13501351
var value: AnyObject?
13511352
let err = AXUIElementCopyAttributeValue(sysWide, kAXFocusedApplicationAttribute as CFString, &value)
13521353
return Self.accessibilityPermissionState(
13531354
isTrusted: false,
1354-
liveGranted: err != .apiDisabled && err != .notTrusted
1355+
liveGranted: err != .apiDisabled
13551356
)
13561357
}
13571358

0 commit comments

Comments
 (0)