How to save brightness settings?
Check brightness levels by running this command as root:
cat /sys/class/backlight/acpi_video0/max_brightness
(my laptop max brightness is 20)
Set you screen brightness to minimum and check current level by evoking next command
cat /sys/class/backlight/acpi_video0/brightness
(my laptop min brightness level is 0;)
Edit
/etc/rc.local
and add beforeexit 0
the following line:echo YOUR_VALUE > /sys/class/backlight/acpi_video0/brightness
From now on this brightness level will be set every time you start your computer.
if you just wana change and save the screen brightness only, you can use xbacklight
sudo apt-get install xbacklight
after installing, type command to set the screen brightness easily
xbacklight -set `num`
the num
is percentage of your screen brightness.
An easier way to set brightness and contrast
sudo setpci -s `00:02.0` F4.B=`XX`
to set brightness, 00:02.0
is your VGA device code.XX
is hexadecimal form 00 to FF
use lspci
command to find out your VGA device code.
xgamma -gamma `X`
to set contrast,X
from 0 to 1
Personally I prefer starting with the brightness I had the last time I used my computer. Here is how I got that functionality:
First create a file to store your screen brightness between sessions:
cd /etc/init.d
sudo touch prev_brightness
sudo chmod o+w prev_brightness
Then create a script that stores your current screen brightness when shutting down into the file you created in the previous step:
sudo touch save_screen_brightness
sudo chmod +x save_screen_brightness
sudo gedit save_screen_brightness
Put this into the file you just opened:
#!/bin/sh
cat /sys/class/backlight/acpi_video0/brightness > /etc/init.d/prev_brightness
Now we need to make the script run every time we shut down or reboot the computer:
sudo ln -s /etc/init.d/save_screen_brightness /etc/rc0.d/K99save_screen_brightness
sudo ln -s /etc/init.d/save_screen_brightness /etc/rc6.d/K99save_screen_brightness
Finally we need to load the value we stored when starting the computer:
sudo gedit /etc/rc.local
Put this, before exit 0, into the file you just opened:
cat /etc/init.d/prev_brightness > /sys/class/backlight/acpi_video0/brightness
That's it!