Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable ambient-light sensor screen dimming programmatically on OS X

Tags:

macos

iokit

I've been digging around in the kernel code repo for days, but I just can't find this anywhere.

I want to disable/enable/detect the state of the ambient-light sensor based screen dimming that many of the higher end Mac laptops have. This is the dimming that is activated by the "Automatically Adjust Brightness" checkbox in the Display control panel.

Note that I'm NOT talking about the halfdim setting that causes the screen to dramatically dim right before it sleeps. I'm talking about the setting that dims the screen in dark rooms and brightens it in light rooms, which is different.

If anybody can even point me in the right direction I'd be greatfull. I assume it's handled somewhere in IOKit, probably either IOGraphics where screen brightness is handled, or somewhere in IOKit/pwr_mgt, but I just can't find it.

Thanks

Edit: I know you can kind of do this this by addressing System Preferences with AppleScript. I'm looking for the real way, if it exists.

like image 568
peterjb Avatar asked Sep 02 '12 20:09

peterjb


2 Answers

Posting this as it might help someone who like me had already disabled the ambient light sensing but still found their computer was dimming when waking from sleep. Turns out I also needed uncheck the box to "Slightly dim the display while on battery power"

System Preferences > Battery > Slightly dim the display while on battery power

See the image below:

uncheck auto dim on battery

like image 22
tnrich Avatar answered Oct 11 '22 08:10

tnrich


This isn't an API, per sé.. but there are many ways to control launchd via an API.

sudo launchctl stop com.apple.AmbientDisplayAgent

sudo launchctl remove com.apple.AmbientDisplayAgent

Ta Da!

like image 90
Alex Gray Avatar answered Oct 11 '22 06:10

Alex Gray