Is it possible to set the default display brightness so you don't have to re-adjust it everytime you reboot? My laptop display is killing my eyes at the login screen already because it starts at 100% brightness every time.
Is it possible to set the default display brightness so you don't have to re-adjust it everytime you reboot? My laptop display is killing my eyes at the login screen already because it starts at 100% brightness every time.
Review of solutions and offering a (hopefully) better one
Previous solutions
/sys/
-based : good for console@gan
This works
echo 5 > /sys/class/backlight/acpi_video0/brightness
but does not play well with X. More specifically, X is not aware about your preferred settings and you may end up needing to set the brightness manually again at least once, similar to bug #1042359 .setpci
-based : system-dependent, dangerous@erickjohncuevas
Solutions based on things like
setpci -s 01:00.0 F4.B=50
are dangerous. There,01:00.0
is actually an ID targeting a particular board on the PCI bus. And it is system-dependent. That means blindly following this may write configuration registers on some other boards where it may mean anything, from just nothing to crashing the system at some point in the future. Anyway it does not play well with X either.Proposed solution
Advantages/drawbacks
The solution below has these advantages:
It assumes: Ubuntu using lightdm (that is 11.10 and beyond)
It only sets backlight when lightdm starts. But it can be combined with the
/sys
-based solution above if you really need to set backlight earlier.The solution
Copy-paste of these commands should do what you need (
sudo
will probably ask your password).Install
xbacklight
if it is not already installed (it is a small package).You should test
xbacklight
on the command-line to see if it works. For example:Try to figure out a suitable value for your hardware and lighting conditions.
Create a small script running
xbacklight
.You can change the
=30
into another value if you wish.The
|| true
ensures that ifxbacklight
fails for any reason, X can still start.Make the script executable
Instruct
lightdm
to run the script when starting X.Specifically, this adds a line display-setup-script in a lightdm configuration file, but only if there is not one already.
May be tested by restarting
lightdm
from a root session on the console. Or, more simply, by rebooting.Tested on Ubuntu 12.04, 12.10, 13.10, 14.04, 14.10, 16.04.
Please provide feedback about your experience.
source
Actually echoing some value to doesn't help in the brightness as the value will differ from system to system.
First you need to set the brightness of the screen to the level comfortable to you, which can easily be done in System Settings → Brightness & Lock or by using the function keys.
Now go to
/sys/class/backlight/<folder>
(my folder isintel_backlight
)In this folder you can see the
actual_brightness
file and themax_brightness
file. (If you have made any changes to the brightness after opening this file, don't forget to refresh (using Ctrl+R or F5) to see the actual current settings.)Now we need the same value as in the brightness every time we start our system. This can be done by changing every time the value in this folder at the startup. We need to change the rc.local file.
First type these commands in the terminal (which can be opened by searching for Terminal in the dash or by pressing Ctrl+Alt+T):
and add the line
Replace 900 with whatever value you need (that is, the value you got from the above procedure). Also replace
intel_backlight
with the folder name from/sys/class/backlight/
.For example, my /etc/rc.local:
As an aside, I added the line
rfkill block bluetooth
to my rc.local file as I don't use Bluetooth at all but Ubuntu starts Bluetooth every time it reboots (even if the Bluetooth was off before). You can also add it, and just in case you want to use Bluetooth you can always start it again, even if this line is in your rc.local).Don't change the value of
exit 0
in the ending. If that line doesn't exist, add it.Now even if you have restarted the system you will have the same value that you need.
Be careful to not put a brightness value greater than
max_brightness
, as that will throw you an error saying that it is an invalid argument.It isn't default. Whenever I reboot my brightness is set to 100%. Then I set the brightness with command:
Have you look at redshift? It's designed for another purpose (make the screen less bluish at night), but it might solve your problem as well.
To install:
My configuration file (
~/.config/redshift.conf
):If you change brightness-day and brightness-night to a value you like and set temp-day and temp-night to the same value, you will effectively use redshift to set your brightness only.
To make
redshift
autostart at login, select Applications/System tools/Preferences/Startup applications/Add. Name: redshift. Command: /usr/bin/redshift.Once you have your preferred brightness set, you can follow the answer by N0rbert here: Brightness is reset to Maximum on every Restart. In summary:
This should do the trick:
System settings -> Screen -> Brightness
Use the slider to adjust default setting.