系统调节亮度调用的是/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文件默认是没有写权限的,可以要先把它的权限改成可写。
最后在任务栏上创建两个启动器,可以用鼠标很方便的调节亮度了~