Skip to content

Fix Input Monitoring permission flow on macOS 10.15.6+ (#166)#198

Open
jasontitus wants to merge 1 commit into
aahung:masterfrom
jasontitus:fix/input-monitoring-permission-issue-166
Open

Fix Input Monitoring permission flow on macOS 10.15.6+ (#166)#198
jasontitus wants to merge 1 commit into
aahung:masterfrom
jasontitus:fix/input-monitoring-permission-issue-166

Conversation

@jasontitus

Copy link
Copy Markdown

Summary

  • Trigger the Input Monitoring TCC prompt on launch so users actually get asked for the permission CGEventTap requires 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).
  • If Input Monitoring is denied, show a dedicated alert and open System Settings → Privacy & Security → Input Monitoring directly.
  • Get the project building on Xcode 26 / current macOS: bump deployment target 10.12 → 10.13, and remove a hardcoded Apple Development: Xinhong Liu codesign 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, CGEventTapCreate requires both Accessibility and Input Monitoring permission. The app only ever called AXIsProcessTrustedWithOptions, 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 with IOHIDCheckAccess. 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

  • Builds on Xcode 26.4.1 / macOS 26.4 (arm64)
  • Fresh install on a Mac with no prior TCC grants → both Accessibility and Input Monitoring system prompts appear
  • Denying Input Monitoring → help alert shown, System Settings opens to the Input Monitoring pane
  • Granting both → menu bar icon appears and the existing event tap path works unchanged
  • Verify on macOS 10.13 / 10.14 that the #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

  • New "Input Monitoring Help" localization key added to Base.lproj/Localizable.strings only. Other locales fall back to the base string until translations are contributed.
  • Did not touch Pods/ or Podfile.lock to avoid CocoaPods regen noise unrelated to the fix; contributors should run pod install after pulling.

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
@Bluekezhou

Bluekezhou commented Apr 28, 2026 via email

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants