Closed drmfinlay closed 3 years ago
Thank you for your suggestion!
I have added code to check for this, and an additional flag IS_TRUSTED
on Listener
instances. I have pushed the changes to the master branch, but no released version includes this change yet.
Thank you for adding a check for this and for all your work on this splendid library!
Description If accessibility access has not been granted for the application that runs Python (e.g. Terminal), pynput will silently fail to simulate mouse and keyboard input. This will only happen if accessibility access is revoked after the first time you get the system dialogue box prompting you to allow it for the application.
Platform and pynput version macOS version 11.2.3 and pynput version 1.7.3.
To Reproduce
Possible Solution I wonder if the relevant classes for macOS should be adjusted to emit a one-time warning message in this case? The
AXIsProcessTrusted()
function could be used to check if the current process is a trusted accessibility client: