Fix Input Monitoring permission flow on macOS 10.15.6+ (#166)#198
Open
jasontitus wants to merge 1 commit into
Open
Fix Input Monitoring permission flow on macOS 10.15.6+ (#166)#198jasontitus wants to merge 1 commit into
jasontitus wants to merge 1 commit into
Conversation
Since macOS 10.15.6, CGEventTap-based key filtering requires both Accessibility AND Input Monitoring permission, but the app only ever prompted for Accessibility. The TCC system never asked the user to grant Input Monitoring, so the event tap silently no-op'd even after they granted Accessibility, leaving the impression that Unshaky was broken. On launch, call IOHIDRequestAccess(kIOHIDRequestTypeListenEvent) to trigger the Input Monitoring TCC prompt the first time it's needed, then verify with IOHIDCheckAccess. If permission is missing, show a dedicated help alert and open System Settings -> Privacy & Security -> Input Monitoring directly (Privacy_ListenEvent pane), separate from the existing Accessibility flow. Also gets the project building on Xcode 26 / current macOS: - Bump deployment target 10.12 -> 10.13 (Xcode 26 minimum) - Remove hardcoded "Apple Development: Xinhong Liu" identity from the Sparkle re-sign script phase, which forced every other developer's build to fail at codesign
|
您的邮件已收到,谢谢!
|
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.
Summary
CGEventTaprequires on macOS 10.15.6+, instead of silently failing after they grant only Accessibility (issue Doesn't work at all on Catalina 10.15.6 (Workaround Available, need Input Monitoring permission) #166).Apple Development: Xinhong Liucodesign identity from the Sparkle re-sign script phase that was forcing every non-original-maintainer build to fail at codesign.Why
Since macOS 10.15.6,
CGEventTapCreaterequires both Accessibility and Input Monitoring permission. The app only ever calledAXIsProcessTrustedWithOptions, so the TCC subsystem never prompted for Input Monitoring. Users would grant Accessibility, get no further prompt, and see the event tap silently no-op — exactly the symptom in #166. The community workaround (manually adding the app to Input Monitoring) works but isn't discoverable.The fix calls
IOHIDRequestAccess(kIOHIDRequestTypeListenEvent)on launch (macOS 10.15+), which fires the system prompt the first time and is a cheap no-op afterwards, then verifies withIOHIDCheckAccess. The Accessibility flow is preserved and runs first; Input Monitoring is checked separately so the alert can point at the right pane (x-apple.systempreferences:com.apple.preference.security?Privacy_ListenEvent).Test plan
#available(macOS 10.15, *)guard short-circuits cleanly (I don't have an older Mac handy — would appreciate a second pair of eyes here)Notes
"Input Monitoring Help"localization key added toBase.lproj/Localizable.stringsonly. Other locales fall back to the base string until translations are contributed.Pods/orPodfile.lockto avoid CocoaPods regen noise unrelated to the fix; contributors should runpod installafter pulling.