3

I can't find brightness settings that work from battery mode in the Ubuntu 11.10 screen settings.

There are some settings from Ubuntu 11.04 in gconf, 90% for AC and 60% for battery, but it doesn't work.

How can I have my display brightness dim automatically when on battery power?

1
  • Possible duplicate - however, it could be merely "related".
    – jrg
    Nov 16, 2011 at 12:42

6 Answers 6

6

I tried a lot of things to no avail to get gnome-control-center in 11.10 to handle this like gnome-power-manager used to.

I decideded to create a script and install it into pm-utils.

#!/bin/sh

ON_AC=##
ON_BATT=##

if ["$1" = "true"]; then

    echo $ON_BATT > /sys/class/backlight/<device directory>/brightness

fi

if ["$1" = "false"]; then

    echo $ON_AC > /sys/class/backlight/<device directory>/brightness

fi

exit 0

I kept it simple because (hopefully) it is a temporary solution. You must manually set your desired values in the two variables above. Use the slider in the "Screen" settings gui to set your desired brightness, then use cat /sys/class/backlight/<device directory>/brightness to retrieve the corresponding numerical value. Substitue the name of your device's directory for <device directory>. Do it once for AC brightness and once for battery brightness. Plug the name of your device directory and the brightness values into the script.

Save the script to a file in your home directory or wherever. I called it backlight. Make it executable with chmod a+x backlight and install it to pm-utils with sudo install backlight /usr/lib/pm-utils/power.d/

I'm not sure how it works resuming from suspend/hibernate because I don't use it, but it works well when booting with or without ac, as well as when hotplugging the charger.

3

To set your brightness to dim automatically on battery power go to your System Settings (search in your dash or go to your power/settings cog), then select Screen. It will give you a slider to turn battery dimming on and off.

As for changing brightness manually, if you don't have function keys to do so you may map key combinations to do so by going to System Settings > Keyboard > Shortcuts tab, and assigning brightness a new value.

2
  • There seems to be no shortcut assignable for this in Ubuntu 12.04. Aug 8, 2012 at 10:33
  • 1
    there is no setting for automatic brightness mate!
    – BRKsays
    Jan 13, 2013 at 17:56
0

The answer above by @Joey did not worked for me, probably things have changed in 13.10 but it gave me a hint that such script might work, so i searched and found a solution in archlinux wiki Archlinux wiki

You can put following in that backlight script, make it executable and put it in /usr/lib/pm-utils/power.d/. and plus change the paths and brightness values according to your settings. i have dual graphics system, and acpi_video0 i think is my amd graphics card settings, if you have intel graphics, you can change acpi_video0 to intel_backlight, or first navigate to that directory and check what do you have, intel_backlight or acpi_video0 or something else. then you can check your brightness values in actual brightness file and maximum brightness file. and finally make sure that you have right permissions for that file.

#!/bin/bash

case $1 in
    true)
        echo 12 > /sys/class/backlight/acpi_video0/brightness
    ;;
    false)
        echo 100 > /sys/class/backlight/acpi_video0/brightness
    ;;
esac
0

Open your Terminal and type xgamma -gamma followed by a value. Normal brightness is 1, so you can set 1.2 or 1.3 if you want to make it brighter, or .5 or 0.75 if you want to make it dimmer.

1
  • 2
    I want automatic brightness changes when switch AC/battery
    – ZhEKa
    Nov 16, 2011 at 7:33
-2

You don't say you've tried the obvious, so just in case ...

Does you machine have Fn keys to do that? On mine it's Fn-up and Fn-down to adjust brightness.

Try it, it might even work! ;)

4
  • 1
    -1, for two reasons: snarky answers are not appreciated, and secondly, there is a comment on the other answer that explains that isn't wha the question is about.
    – jrg
    Nov 16, 2011 at 12:36
  • Ok, just seen the comment about wanting it automated. Ignore me, I need to read more before typing .... and yes, the settings have vanished with Gnome3 (or is it Unity?)
    – ams
    Nov 16, 2011 at 12:38
  • They haven't been removed, gnome simply moved them. This question is a duplicate of this one: askubuntu.com/questions/33457/…
    – jrg
    Nov 16, 2011 at 12:41
  • Yes, Fn keys are work, but why don't work old Gnome setting that works fine in 11.04? And How to set same options in curent 11.10 Unity?
    – ZhEKa
    Nov 16, 2011 at 12:48
-2

You can try this in Ubuntu 11.10:

Add this code

("echo 10 > /sys/class/backlight/acpi_video1/brightness" and "echo 5 > /sys/class/backlight/acpi_video1/brightness", without " ") in /usr/lib/pm-utils/power.d/laptop-mode 

laptop_mode_ac() {
    # disable laptop mode, set vm parameters back to sane defaults
    if state_exists laptop_mode_default; then
    write_values $(restorestate laptop_mode_default)
    else
    write_values 0 10 5 500
    fi  
    echo "Laptop mode disabled."
    echo 10 > /sys/class/backlight/acpi_video1/brightness

}

laptop_mode_battery() {
    # enable laptop mode, set vm parameters to buffer as many writes as 
    # possible.
    state_exists laptop_mode_default || \
    read_values | savestate laptop_mode_default
    write_values "$LAPTOP_MODE" "$LAPTOP_DIRTY_RATIO" \
    "$LAPTOP_DIRTY_BG_RATIO" "$LAPTOP_DIRTY_WRITEBACK"
    echo "Laptop mode enabled."
    echo 5 > /sys/class/backlight/acpi_video1/brightness
}

Not the answer you're looking for? Browse other questions tagged .