Enable access for assistive device programmatically
Posted
by Dheeraj
on Stack Overflow
See other posts from Stack Overflow
or by Dheeraj
Published on 2010-06-01T13:28:09Z
Indexed on
2010/06/01
19:23 UTC
Read the original article
Hit count: 306
Hi All,
I want to enable Access for assistive devices in System Preferences programmatically. But Problem is that my application is not running as root user and i do not want my application to be as root user and also should not ask for any authentication in between.
I want to tap all keyboard events globally. I am using CGEventTapCreate() for the same.In the documentation of CGEventTapCreate() API it is mentioned that, Event taps receive key up and key down events if one of the following conditions is true:
- The current process is running as the root user.
- Access for assistive devices is enabled. In Mac OS X v10.4 & later, you can enable this feature using System Preferences, Universal Access panel, Keyboard view.
I tried manually by checking the Enable Access for assistive devices from System Preference and it gives me expected output.
So is there any way to do the same via program without asking for authentication and also application is not running as root user?
Thanks,
Dheeraj.
© Stack Overflow or respective owner