Search code examples
objective-cmacoscocoamac-app-store

Toggle "Illuminate keyboard" without using private APIs


Is there a way to turn on and off the "Illuminate keyboard" setting programmatically, without using private APIs?

I need to do it in a way that will be accepted by the Mac App Store.


Solution

  • You can try to use the ScriptingBridge framework; it works by sending Apple events. The System Preferences application exposes ScriptingBridge bindings so you can access it.

    Here some starting points:

    If you go with ScriptingBridge and want to submit your application the Mac App Store, then you have to request a temporary exception entitlement to allow your application to send Apple events; check the Entitlement Key Reference to learn more about it.