linux怎么样调节亮度

2022-08-06 科技 120阅读
系统调节亮度调用的是/sys/class/backlight/acpi_video0下的brightness文件。而实际上,亮度由/sys/class/backlight/intel_backlight/brightness决定。我一开始的想法是把acpi_video0指向intel_backlight,没成功,可能是我对Linux不太熟。所以直接用FN快捷键来调节亮度我是实现不了了。退而求其次,我写了两个脚本来增加/降低亮度。
降低亮度:

if [ ! -w /sys/class/backlight/intel_backlight/brightness ];then
echo "password" | sudo -S chmod 777 /sys/class/backlight/intel_backlight/brightness
fi

read bright < '/sys/class/backlight/intel_backlight/brightness'

v=600
v=$(($bright - 4882 / 9 ))

echo $v | tee /sys/class/backlight/intel_backlight/brightness
增加亮度:

if [ ! -w /sys/class/backlight/intel_backlight/brightness ];then
echo "password" | sudo -S chmod 777 /sys/class/backlight/intel_backlight/brightness
fi

read bright < '/sys/class/backlight/intel_backlight/brightness'

v=600
v=$((4882 / 9 + $bright))

echo $v | tee /sys/class/backlight/intel_backlight/brightness
因为brightness文件默认是没有写权限的,可以要先把它的权限改成可写。

最后在任务栏上创建两个启动器,可以用鼠标很方便的调节亮度了~
声明:你问我答网所有作品(图文、音视频)均由用户自行上传分享,仅供网友学习交流。若您的权利被侵害,请联系fangmu6661024@163.com