Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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.

share|improve this question
    
possible duplicate of How to make GNOME remember brightness setting –  Jorge Castro Oct 15 '11 at 11:32
    
Try this askubuntu.com/questions/481413/… –  KasiyA Jul 6 at 21:30

4 Answers 4

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:

  • plays nice with X which is fully aware of the settings chosen
  • is more readable, thus maintainable
  • does not contain system-specific address, etc, and as a result may work on a wider range of hardware (e.g. where kernel does not know about backlight, or that don't even use PCI-based video board, think Ubuntu for ARM )

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 this should do what you need (sudo will probably ask your password).

# 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 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

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, works like a charm. Adjusted for 14.04.

Please provide feedback about your experience.

share|improve this answer
1  
On a freshly installed Ubuntu 12.10, copy-paste of the lines above just works. –  Stéphane Gourichon Jan 2 '13 at 15:38
    
Works for me too. –  Pawelmhm Sep 21 '13 at 11:01
    
On a freshly installed Xubuntu 13.10, copy-paste of the lines above just works. –  Stéphane Gourichon Nov 7 '13 at 5:41
    
Adjusted just now for Ubuntu 14.04, tested, works. If xbacklight fails, does not prevent X from starting. –  Stéphane Gourichon Jul 6 at 21:46

It isn't default. Whenever I reboot my brightness is set to 100%. Luckily I saw

$ echo 5 > /sys/class/backlight/acpi_video0/brightness

and before that,

$ chmod o+w /sys/class/backlight/acpi_video0/brightness
share|improve this answer

this works in my 12.04 How set brightness on startup – Ubuntu 12.04

every time i boot up, it is set already. hope it will help you.

share|improve this answer

This should do the trick:

System settings -> Screen -> Brightness

Use the slider to adjust default setting.

enter image description here

share|improve this answer
8  
Doesn't "stick" for reboots, at least for me on Precise (12.04) for an HP Envy Ultrabook –  hobs Aug 11 '12 at 18:14
    
Same with Acer Aspire One –  Martin Delille Nov 11 at 13:40

protected by Community Feb 13 '12 at 12:24

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.