Detect denied Accessibility access on macOS 15+ (fixes #48) - #51
Open
timokox wants to merge 1 commit into
Open
Conversation
The macOS-15+ branch of the launch-time Accessibility check was casting
the result of AXIsProcessTrustedWithOptions() to void and moving on.
That was deliberate (the no-prompt variant is used to register the app
with TCC without nagging on every launch), but it has a nasty failure
mode after major OS upgrades:
- Tahoe 26.5 re-prompts for TCC permissions.
- User has not yet re-granted (or actively denied) Accessibility.
- Jiggler launches fine, the menu-bar icon turns green when it thinks
it's jiggling, but every CGEventPost is silently dropped because
the process is not Accessibility-trusted.
- The Mac still goes to sleep / runs the screensaver.
That is exactly the symptom @Creativotech reported on issue bhaller#48 after
upgrading from 26.1 to 26.5.
Unify the trust check across versions: the 15+ branch now captures the
result of AXIsProcessTrustedWithOptions(), and the rest of the flow
(critical alert, deep-link to System Settings > Privacy & Security >
Accessibility, then terminate) is shared with the legacy 10.15-14
path. Alert text is also updated from "Security & Privacy" to the
current "System Settings > Privacy & Security" pane wording, and from
"the mouse cursor" to "the mouse and keyboard" since keyboard events
are also synthesised in some jiggle modes.
Verified: builds clean, smoke-test on this machine correctly fires the
alert (the DerivedData build path is not Accessibility-trusted, so the
new code path runs).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #48. Probably also explains a chunk of the other "v1.10 stopped working on Tahoe" reports.
Root cause
The macOS-15+ branch of the launch-time Accessibility check casts the result of
AXIsProcessTrustedWithOptions()tovoidand moves on:The intent is clearly to register with TCC via the no-prompt variant so the app appears in System Settings without nagging on every launch — but the failure mode after major OS upgrades is bad:
CGEventPostis silently dropped because the process is not Accessibility-trusted on modern macOS.That matches the user-visible symptom in #48 ("Jiggler appears to run … Mac still goes to sleep") exactly.
Fix
Unify the trust check: the 15+ branch now captures the boolean result of
AXIsProcessTrustedWithOptions()(no-prompt behaviour preserved — we still passkAXTrustedCheckOptionPrompt = false). Both version branches feed into the sameif (!accessibilityTrusted) { … alert … open Settings … terminate; }block.Wording of the alert is also touched:
Verification
xcodebuild -configuration Debug build→BUILD SUCCEEDED, no warnings. Smoke-tested on macOS 26.4.1: my DerivedData build path is not Accessibility-trusted, so the new check correctly catches the denial and fires the alert + terminate (unified log showsNSAccessibility Request Received→terminate:~130 ms later). In production a user sees the alert and is deep-linked into the right Settings pane.Repro path for testers
After installing this build, once: remove Jiggler from System Settings > Privacy & Security > Accessibility, then launch Jiggler. Should now show the alert and open Settings, instead of silently lying about jiggling.