Tell me more ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

On my Macbook Pro Ubuntu alsways boots with...

  • keyboard brightness at maximum illumination
  • screen brightness at maximum illumination

...both which I need almost never during normal usage.

Question

Instead of directly manipulating configuration files, I'm thinking of a solution that would work like a script and set both brightness settings to a lower default. How might this be accomplished?

Unfortunately, I have no experience in scripting and would be glad if you can help me out here.


I've figured out what needs to be done to change both the screen brightness and the keyboard backlight. Can you help be to make this a script that is automatically run at login?

Change Keyboard backlight

echo 130 | sudo tee -a /sys/class/leds/smc::kbd_backlight/brightness

...where 255 is the maximum brightness and 0 is the lowest brightness.

Change screen brightness

echo 42311 | sudo tee /sys/class/backlight/gmux_backlight/brightness 

...where 4126 is the lowest brightness and 82311 the hightest.


I've noticed a another problem.. If I run echo 42311 | sudo tee /sys/class/backlight/gmux_backlight/brightness right after login, but then use the brightness buttons. The screen brightness settings first reset to maximum - and then the change get's applied. This is seems messed up...

share|improve this question
I'm running 12.04. – gentmatt May 11 '12 at 13:22

1 Answer

up vote 5 down vote accepted
+25

You can have root run the brightness commands upon reboot, by adding those commands to /etc/rc.local (gksudo gedit /etc/rc.local), so that it looks like:

#!/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.

echo 130 >> /sys/class/leds/smc::kbd_backlight/brightness
echo 42311 > /sys/class/backlight/gmux_backlight/brightness

exit 0

See also Brightness is reset to Maximum on every Restart

share|improve this answer
Great! This looks like it should work. I have to tell you that I currently run Ubuntu only in VM and have removed the native install on my MBP. So, I'll have to try this later still. But thank you very much already! – gentmatt Nov 4 '12 at 8:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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