通过让ubuntu开机自动运行脚本解决亮度问题
1.建立rc-local.service文件
sudo gedit /etc/systemd/system/rc-local.service
2.将以下内容复制到rc-local.service文件中
[Unit]
Description=/etc/rc.local Compatibility
ConditionPathExists=/etc/rc.local
[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99
[Install]
WantedBy=multi-user.target
3.如果在/etc/下面没有rc.local文件,则创建
sudo gedit /etc/rc.local
4.复制以下代码到rc.local文件中
如果你/sys/class/backlight/文件夹下为nvidia_0则复制以下内容
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
echo 40 > /sys/class/backlight/nvidia_0/brightness
exit 0
nvidia最大亮度为100,选择你自己感觉合适的一个亮度数值。
如果你/sys/class/backlight/文件夹下为intel_backlight则复制以下内容
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
echo 1200 > /sys/class/backlight/nvidia_0/brightness
exit 0
5.给rc.local加上权限并启用服务
sudo chmod +x /etc/rc.local
sudo systemctl enable rc-local
sudo systemctl start rc-local.service
sudo systemctl status rc-local.service
只要不报错就行
重启后亮度变了就成功了。