在OS X上以编程方式禁用环境光传感器屏幕变暗 [英] Disable ambient-light sensor screen dimming programmatically on OS X

查看:92
本文介绍了在OS X上以编程方式禁用环境光传感器屏幕变暗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在内核代码存储库中挖掘了好几天了,但是我在任何地方都找不到.

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

我想禁用/启用/检测许多高端Mac笔记本电脑具有的基于环境光传感器的屏幕变暗状态.这是由显示控制面板中的自动调整亮度"复选框激活的调光.

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.

请注意,我并不是在说[strong> NOT (半昏暗)设置,该设置会导致屏幕在休眠之前急剧变暗.我说的是在黑暗的房间中调暗屏幕,在明亮的房间中调亮屏幕的设置.

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.

如果有人甚至可以将我指向正确的方向,我会很满足的.我认为它是在IOKit的某个地方处理的,可能是处理屏幕亮度的IOGraphics或IOKit/pwr_mgt的某个地方,但我只是找不到它.

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.

谢谢

我知道您可以通过使用AppleScript处理系统偏好设置来做到这一点.我正在寻找真实的方式,如果存在的话.

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.

推荐答案

尝试在Mavericks上执行此操作对我而言是不成功的.经过研究,我发现您需要使用以下命令:

Trying to do this on Mavericks was unsuccessful for me. After some research I've discovered you need to use the following command:

defaults write /Library/Preferences/com.apple.iokit.AmbientLightSensor "Automatic Display Enabled" -bool TRUE

我认为指定完整路径是必要的,否则它将默认为用户的库/首选项",这是不正确的.由于defaults的工作方式,因此无法在Terminal中的该目录中工作.

I believe specifying the full path is necessary else it would default to the user's Library/Preferences which is incorrect. Being in that directory in Terminal doesn't work either due to the way defaults works.

这不会更新系统偏好设置"->显示"中的复选框.

This does not update the tickbox in System Preferences -> Displays though.

这篇关于在OS X上以编程方式禁用环境光传感器屏幕变暗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆