Hi,
I am working on a macOS app that is a background app and so I would like to perform a particular function when a keyboard key is pressed. I read from the apple documentation that addGlobalMonitorForEvents(matching:handler: ) must be used. And also to use this, accessibility must be enabled. I checked for accessibility with AXIsProcessTrustedWithOptions and the functionality has been implemented and it works right if accessibility is enabled. I give an alert to the user asking to enable accessibility and if the user agrees, the accessibility in the privacy system preferences window opens. Now, the issue I face is the app is not present in the accessibility list and so the user has to add the app manually into the list.
Is there any way to programmatically(SWIFT) add the app to the accessibility list?
I am working on a macOS app that is a background app and so I would like to perform a particular function when a keyboard key is pressed. I read from the apple documentation that addGlobalMonitorForEvents(matching:handler: ) must be used. And also to use this, accessibility must be enabled. I checked for accessibility with AXIsProcessTrustedWithOptions and the functionality has been implemented and it works right if accessibility is enabled. I give an alert to the user asking to enable accessibility and if the user agrees, the accessibility in the privacy system preferences window opens. Now, the issue I face is the app is not present in the accessibility list and so the user has to add the app manually into the list.
Is there any way to programmatically(SWIFT) add the app to the accessibility list?