deepin 15.4屏幕亮度调节
Tofloor
poster avatar
Aladding
deepin
2017-05-04 21:15
Author
Linux Deepin 15.4 beta 亮度调节。每次进入系统时这个文件都会被重置为最大值100 我设置的是52,所以直接更改这个文件的值是没用的。我们可以用以下两个步骤来让系统启动后自动设置屏幕的亮度值。
  • 更改rc.local文件使系统在启动时自动更改/sys/class/backlight/acpi_video0/brightness文件权限
  • 更改.profile文件使系统在用户登录时自动更改birghtness的值
具体操作步骤:
第一步,更改rc.local文件使系统在启动时自动更改/sys/class/backlight/acpi_video0/brightness文件权限
在终端输入
sudo gedit /etc/rc.local
如果询问密码的话,输入你安装系统时设置的密码
打开后你会看到如下内容:
#!/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.
#exit 0
插入这句话到代码中:
chmod a+w /sys/class/backlight/acpi_video0/brightness
保证修改后代码如下,注意删除exit前的“#”
#!/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.
chmod a+w /sys/class/backlight/acpi_video0/brightness
exit 0
保存退出。
第二步,更改.profile文件使系统在用户登录时自动更改birghtness的值
进入主文件夹,点击“查看”,点击“显示隐藏文件”。找到.profile文件,双击打开。
在.profile最后一行添加
echo 52 > /sys/class/backlight/acpi_video0/brightness
其中数字52为你设定的屏幕亮度值,最大值为100。
保存退出。
这样每次进入系统后屏幕的亮度都会自动设置为.profile文件中设定的值。

Reply Favorite View the author
All Replies
avatar
jingle
deepin
2017-05-04 21:31
#1
谢谢分享
Reply View the author
avatar
justforlxz
deepin
2017-05-05 00:24
#2
本帖最后由 kirigaya 于 2017-5-4 16:27 编辑

如果是从控制中心首页去改亮度,没有保存的话,这个bug已经修好了。

现在的发行版都换systemd了,编辑/etc/rc.local还有用吗,,,
#补充
好吧,rc.local被systemd托管了,不过deepin上rc-local.service是dead状态,所以编辑这个文件应该没用的。
Reply View the author
avatar
numb
deepin
2017-05-16 03:32
#3
rc.local已经没有了 只操作第二步行吗?
Reply View the author
avatar
kaliliu
deepin
2017-06-03 03:49
#4
https://bbs.deepin.org/post/138919
如果是从控制中心首页去改亮度,没有保存的话,这个bug已经修好了。

现在的发行版都换systemd了,编辑/etc ...

可以调整亮度,但不能保存!bug仍未修复。测试机器(iIBM X61T & T430)
Reply View the author
avatar
justforlxz
deepin
2017-06-05 17:04
#5
https://bbs.deepin.org/post/138919
可以调整亮度,但不能保存!bug仍未修复。测试机器(iIBM X61T & T430)

从全部设置->显示 里面调整也不会保存吗?
Reply View the author
avatar
153******66
deepin
2017-06-05 17:53
#6
我是自己写脚本做的,
  1. #!/bin/bash

  2. Pid="/tmp/watch_battery.pid"
  3. Log="/tmp/watch_battery.log"
  4. Mouse_Name='A4TECH'
  5. #BATPATH=$(ls -d /sys/class/power_supply/BAT*|head -n1)
  6. #STATUS=$BATPATH/status
  7. Discharge="1"
  8. Charge="0"
  9. Light="800"
  10. Black="130"
  11. BackLight='/sys/class/backlight/intel_backlight/brightness'

  12. # powertop
  13. powertop --auto-tune 2 > $Log
  14. # enable bluetooth mouse
  15. mouse_id=$(dmesg |grep "Manufacturer: $Mouse_Name"|egrep -o '[0-9]\-[0-9]'|tail -n1)
  16. [ ! -z $mouse_id ] && echo 'eleven' | sudo -S sh -c "echo on > /sys/bus/usb/devices/$mouse_id/power/control"


  17. function ExitClean()
  18. {
  19.     rm -rf /tmp/watch_battery*
  20. }

  21. function watch_battery_event()
  22. {
  23.     trap ExitClean EXIT QUIT

  24.     while true
  25.     do
  26.         now_status=$(acpi|grep Charging > /dev/null ; echo $?)
  27.         #now_status=$(cat $STATUS)
  28.         now_backlight=$(cat $BackLight)

  29.         if [ "$now_status" == "$Charge" ]
  30.         then
  31.             if [ $now_backlight -lt $Light ]
  32.             then
  33.                 echo 'eleven' | sudo -S sh -c "echo $Light > $BackLight"
  34.                 echo "$(date) now battery status is: $now_status " >> $Log
  35.             else
  36.                 echo "$(date) now battery status is : Charge, and now backlight is : $(cat $BackLight), and I'm has alive" >> $Log
  37.                 sleep 3
  38.             fi
  39.         elif [ "$now_status" == "$Discharge" ]
  40.         then
  41.             if [ $now_backlight -gt $Black ]
  42.             then
  43.                 echo 'eleven' | sudo -S sh -c "echo $Black > $BackLight"
  44.                 echo "$(date) now battery status is: $now_status " >> $Log
  45.             else
  46.                 echo "$(date) now battery status is : Discharge, and now backlight is : $(cat $BackLight), and I'm has alive" >> $Log
  47.                 sleep 3
  48.             fi
  49.         else # status is unknow, nothing todo
  50.             sleep 30
  51.         fi
  52.     done
  53. }

  54. function main()
  55. {
  56.     if [ -f $Pid ]
  57.     then
  58.         echo "process has runing, pid: $(cat $Pid)"
  59.         exit
  60.     else
  61.         watch_battery_event &
  62.         sleep 1
  63.         echo $! > $Pid;   
  64.     fi
  65. }

  66. main
Copy the Code
Reply View the author
avatar
kaliliu
deepin
2017-06-06 17:40
#7
https://bbs.deepin.org/post/138919
从全部设置->显示 里面调整也不会保存吗?

这个我倒是没试过,一直都用的fn+f8,下次试试!~感谢提醒!
Reply View the author
avatar
DebuggerX
deepin
2017-06-06 18:43
#8
https://bbs.deepin.org/post/138919
我是自己写脚本做的,

可以~~
我笔记本小米13,也用了powertop,也是用的脚本读充电状态去更改cpu频率和亮度。。
不过我的脚本没你写得这么复杂,而且没敢用死循环,而是corntab每分钟跑一次……
Reply View the author
avatar
153******66
deepin
2017-06-06 21:53
#9
https://bbs.deepin.org/post/138919
可以~~
我笔记本小米13,也用了powertop,也是用的脚本读充电状态去更改cpu频率和亮度。。
不过我的脚 ...

跑daemon嘛,
Reply View the author
avatar
kaliliu
deepin
2017-06-07 02:02
#10
https://bbs.deepin.org/post/138919
从全部设置->显示 里面调整也不会保存吗?

试了,不行!
Reply View the author
avatar
sydeepin
deepin
2017-06-07 07:16
#11
只想知道有没有快捷键,觉得还是快捷键靠谱方便
Reply View the author
avatar
kaliliu
deepin
2017-06-07 18:21
#12
https://bbs.deepin.org/post/138919
只想知道有没有快捷键,觉得还是快捷键靠谱方便

有快捷键,就是每次需要从头设定亮度!
Reply View the author
avatar
Aladding
deepin
2017-06-08 21:35
#13
https://bbs.deepin.org/post/138919
rc.local已经没有了 只操作第二步行吗?

                      可以的
Reply View the author
avatar
numb
deepin
2017-06-09 23:09
#14

更改了/etc/profile里面添加了echo 600 > /sys/class/backlight/acpi_video0/brightness,默认最低是976
可是开机是普通用户登录,亮度还是高,只有root才行,怎么办?
Reply View the author