让Ubuntu记住屏幕亮度.

折腾了好几天,终于在笔记本上让 Ubuntu 14实现了关机/重启前记住当前亮度值,开机后恢复.

网上找到的解决方案在我笔记本上都不完全好使,中间跳过的坑就不说了.

1.安装 xbacklight.

<!-- lang: shell -->
sudo apt-get install xbacklight

2.创建开机后恢复亮度值的脚本.

创建:

<!-- lang: shell -->
sudo vi /etc/lightdm/display-setup-script.sh

内容:

<!-- lang: shell -->
#!/bin/sh
xbacklight -set `cat /etc/lightdm/backlight.save`

保存:

<!-- lang: shell -->
:wq

添加执行权限.

<!-- lang: shell -->
sudo chmod +x  /etc/lightdm/display-setup-script.sh

3.创建关机/重启前记住当前亮度值的脚本.

创建:

<!-- lang: shell -->
sudo vi /etc/lightdm/session-cleanup-script.sh

内容:

<!-- lang: shell -->
#!/bin/sh
cp /sys/class/backlight/acpi_video0/actual_brightness  /etc/lightdm/backlight.save

保存:

<!-- lang: shell -->
:wq

添加执行权限.

<!-- lang: shell -->
sudo chmod +x  /etc/lightdm/session-cleanup-script.sh

4.创建配置文件,将两个脚本分别设为登录,退出时启动.

创建:

<!-- lang: shell -->
sudo vi /etc/lightdm/lightdm.conf

内容:

<!-- lang: shell -->
[SeatDefaults]
display-setup-script=/etc/lightdm/display-setup-script.sh
session-cleanup-script=/etc/lightdm/session-cleanup-script.sh

保存:

<!-- lang: shell -->
:wq

你可能感兴趣的:(ubuntu,lightdm,xbacklight)