I'm writing a macOS app in which I'd like to do something with the value of the screen brightness as soon as it changes.
I can determine what the screen brightness is by iterating over IOService
s with IOServiceGetMatchingServices()
then using IODisplayGetFloatParameter()
to obtain the kIODisplayBrightnessKey
parameter of the IODisplayConnect
services I found, as explained in this answer, but I don't know how to find out when the brightness has changed.
Is there a way for my app to get notified as soon as the screen brightness has changed?
I could poll, and I know how to do that, but that's not what I'm looking for. I'm looking for something like UIScreen.brightnessDidChangeNotification
, but for macOS.