解决Ubuntu18开机最大亮度问题

通过让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

只要不报错就行

重启后亮度变了就成功了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值