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

Add support for keyboard / mouse capture permissions (CGEventTapCreate) #33

Closed
miniak opened this issue Nov 8, 2021 · 1 comment
Closed
Assignees
Labels
enhancement New feature or request

Comments

@miniak
Copy link

miniak commented Nov 8, 2021

https://asciiwwdc.com/2019/sessions/701

Monitoring all keyboard events, including those for other apps, however, requires user approval.

And here you can see an example of using CGEventTapCreate to invoke a callback for key press and release events.

Now, the first time this code runs, this call, the CGEventTapCreate will fail and return nil.

Meanwhile, a dialog is displayed directing the user to the security and privacy preference pane, where the user can approve your app to monitor keyboard events in the background, if they so desire.

Now, apps may check the authorization status without triggering the approval prompt, using the IOHIDCheckAccess function with the kIOHIDRequestTypeListenEvent parameter.

And apps can request an approval dialog to be displayed without creating an event tab or trying to post an event by using the IOHIDRequestAccess function, again with the same parameter.

So in summary, macOS Catalina now requires user consent for apps to record the contents of your screen or the keys that you type on your keyboard.

@codebytere
Copy link
Owner

ty @miniak i'll do this soon!

@codebytere codebytere self-assigned this Nov 9, 2021
@codebytere codebytere added the enhancement New feature or request label Nov 9, 2021
codebytere added a commit that referenced this issue Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants