Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trackpad becomes unresponsive after revoking Accessibility permission #63

Open
ris58h opened this issue Mar 27, 2023 · 7 comments · May be fixed by #64
Open

Trackpad becomes unresponsive after revoking Accessibility permission #63

ris58h opened this issue Mar 27, 2023 · 7 comments · May be fixed by #64
Assignees
Labels
bug Something isn't working

Comments

@ris58h
Copy link

ris58h commented Mar 27, 2023

Steps to reproduce:

  • Run MiddleClick.
  • Grant MiddleClick access to Accessibility in System Settings > Privacy & Security.
  • Revoke Accessibility permission. Or run tccutil reset Accessibility in terminal to reset Accessibility settings.

Expected result:
MiddleClick stops working, other things work.

Actual result:
Trackpad becomes unresponsive and it's not possible to click with it (some gestures work though).

MiddleClick 2.6.1
macOS 13.2.1

P.S.: killing MiddleClick or just logout(Cmd-Shift-Q) helps.

@artginzburg
Copy link
Owner

Yep, that’s been a long-standing issue. There is a simple way to prevent that — checking Accessibility permissions every second or so and stopping the listeners if the accessibility permission gets lost (the same way the app works after launch, just boolean-inverted). I’m not sure if this is the best solution.

Obviously, for maintainability of this app it would be better to use an already existing library implementing Multitouch. I majorly dislike the fact that the multitouch logic and the middle click logic is in the same file.

@ris58h
Copy link
Author

ris58h commented Mar 28, 2023

In Touch-Tab I've switched from Multitouch to CGEventTap. I use .listenOnly option and it doesn't make trackpad unresponsive on revoking Accessibility permission, using .defaultTap does though.

@artginzburg
Copy link
Owner

This .listenOnly option (kCGEventTapOptionListenOnly in Obj-C) is magic! Indeed, it leaves the trackpad responsive on revoking Accessibility permission.

The only thing I noticed is that with that option, on Ventura, MiddleClick starts asking for Input Monitoring instead of Accessibility, even though it works fine with just the Accessibility.

Another strange thing is that sometimes when I granted the Input Monitoring just for a test, the Accessibility permission became granted automatically, but sometimes it did not. Couldn't catch any pattern here.

@ris58h ris58h changed the title Trackpad becomes unresponsive after resetting Accessibility settings via tccutil Trackpad becomes unresponsive after revoking Accessibility permission Mar 29, 2023
@ris58h
Copy link
Author

ris58h commented Mar 29, 2023

Have you tried using AXIsProcessTrustedWithOptions? It allows to prompt a user to grant Accessibility permission.

@artginzburg
Copy link
Owner

Just tried that — MiddleClick now asks for Accessibility permission, as intended. Good. Thanks!

I also like that running AXIsProcessTrustedWithOptions on an interval makes it essentially a persistent prompt that cannot be closed until the app is closed. Might seem unintended for someone, but actually it's useful because unlikely the user will be willing to keep the app open without giving it the permission.

artginzburg added a commit that referenced this issue Mar 29, 2023
- Use `AXIsProcessTrustedWithOptions` instead of `AXIsProcessTrusted`
- Use event tap option `.listenOnly` instead of `.default`

closes #63

Co-Authored-By: Ilya Rodionov <[email protected]>
@artginzburg artginzburg self-assigned this Mar 29, 2023
@artginzburg artginzburg added the bug Something isn't working label Mar 29, 2023
@artginzburg
Copy link
Owner

There is a problem with this .listenOnly approach: if "Tap to click" is disabled — the app stops doing anything. mouseCallback() doesn't get called. The fun thing though is that the app seems to read clicks when the pointer is right above the app's menu bar icon.

In the end, I got it working by granting the "Input Monitoring" permission additional to the "Accessibility" permission. I guess that's why the app was initially asking for it until we suppressed it with AXIsProcessTrustedWithOptions.

@ris58h
Copy link
Author

ris58h commented Apr 2, 2023

I believe (may be I'm wrong about that) that if an app has Accessibility permission it doesn't need to haveInput Monitoring permission granted. In other words Accessibility permission contains Input Monitoring permission.

Could you try not to start any input monitoring until Accessibility permission is granted? It works for me in Touch-Tab.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants