I can register for notifications that the entire system will go to sleep using IORegisterForSystemPower, and this works fine. However, this doesn't seem to report when the display is turned off without the system as a whole going to sleep.
Is there an API (possibly higher level than IOKit, such as AppKit) for being notified of those events? And if not, is there some other notification which coincides with it where I can then poll displays for whether they are asleep using CGDisplayIsAsleep()? (The callback registered with CGDisplayRegisterReconfigurationCallback is not called when the display goes to sleep.)
Try
NSWorkspace.screensDidSleepNotification.