Detect macOS Night Shift?

All my macs are calibrated once, and then used for many months. Currently we trust the user not to turn on macOS Night Shift, which invalidates the calibration. Does anyone know a way for MATLAB to detect whether Night Shift is on? Ideally, I’d like to turn it off, but just detecting it would suffice. I would issue a fatal error, refusing to run the experiment until Night Shift is off, asking the user to turn it off manually. That would be fine.

I found several links to code that seem to have figured this out. Is anyone game to port it to macOS? I don’t think of this as a macOS feature, Detecting Night Shift is a necessary part of being sure that the mac is back in the calibrated state.

https://shifty.natethompson.io/en/


Best
Denis

Denis Pelli
NYU

If any of these are command line apps or can easily be converted to one, you can call them easily with system(), without having to integrate anything into PTB. Perhaps thats the first route to try?

Does Shifty offer an applescript dictionary[1], if so you can then use the osascript command via system()


[1] check using the built-in Script Editor.app or the free and excellent Script Debugger

Alas, no. Thanks anyway.

Thx. I haven’t checked yet. It might have an Apple dictionary, or the author might be willing to add it. I just haven’t had time to dive into this. I did just that to offer Brightness control, using Applescript to control the Brightness slider and disable “Automatic brightness adjustment” in Apple’s System Preferences Displays.

Update. I contributed MacDisplaySettings to Psychtoolbox (already in current version) which allows reading and setting of many fields in System Preferences > Displays, including all the titles in NightShift.