红联Linux门户
Linux帮助

Ubuntu设置开机时的屏幕亮度

发布时间:2016-11-17 10:07:18来源:linux网站作者:一米阳光213
如果,你的Ubuntu系统每次开机之后屏幕都特别亮,那么别怀疑,你不是第一个发现这个问题的人,本文简要介绍如何解决这个问题。
 
主要参考:
Ubuntu设置开机时的屏幕亮度
 
英语不好的看这边。本解决方法只针对12.04, 12.10, 13.10, 14.04, 14.10。
 
方法一:设置 /sys/class/backlight/acpi_video0/brightness或者/sys/class/backlight/intel_backlight/brightness
这种方法请参考:http://www.linuxdiyf.com/linux/26063.html
 
方法二:在终端下,执行如下脚本(直接复制粘贴并运行,或者建立一个sh脚本再运行都OK)
# Install xbacklight in case it is not already installed (small).  
sudo apt-get install xbacklight  
# You should test xbacklight with command-line to see if it works. For example:  
# xbacklight = 100 ; sleep 2 ; xbacklight = 30  
# Try to figure out a suitable value for your hardware and lighting conditions.  
# This creates a small script running xbacklight.  
# You can change the =30 into another value if you wish.   
# The "|| true" ensures that if xbacklight fails for any reason, X can still start.  
sudo bash -c '{  
echo "#!/bin/bash"  
echo "xbacklight =30 || true"  
} >> /etc/lightdm/display-setup-script.sh '  
# This makes that script executable  
sudo chmod a+rx /etc/lightdm/display-setup-script.sh  
# This instructs lightdm to run the script when starting X.  
# Specifically, it adds a line display-setup-script in a lightdm configuration file/, but only if there is not one already.  
if grep -ri ^display-setup-script /etc/lightdm/  
then   
echo "There may be already a display-setup-script. It may already do what you need. Else please adjust manually" ;   
else   
if [[ -d /etc/lightdm/lightdm.conf.d ]]  
then  
# Ubuntu 13.10 and above have lightdm.conf.d. 14.04 *only* have lightdm.conf.d  
DESTCONFFILE=/etc/lightdm/lightdm.conf.d/20-default-brightness.conf  
else  
# Ubuntu 12.04, 12.10, 14.10 do not have lightdm.conf.d, we change main configuration file  
DESTCONFFILE=/etc/lightdm/lightdm.conf  
fi  
echo "Writing into $DESTCONFFILE"  
sudo bash -c "{ echo '[SeatDefaults]' ; echo display-setup-script=/etc/lightdm/display-setup-script.sh ; } >>$DESTCONFFILE" ;   
fi
 
在我自己的 Ubuntu 14.04 上面,第一种方法无效,第二种方法有效。祝你好运!
 
本文永久更新地址:http://www.linuxdiyf.com/linux/26064.html