3

Does anybody know where I can find a program (or system setting) which turns up the brightness automatically when my laptop is plugged in to AC and turn down the brightness when disconnected from AC?

I'm running Ubuntu 12.04.2 LTS 64-bit

2 Answers 2

1

I'm afraid I don't have a ready solution for you, but some hints that might you help find one on your own. I haven't tried anything of this, so I can't give any guarantees.

Very probably you can catch the plugging/unplugging events with acpid, which can be configured to run shell scripts on such acpi events. To find out if acpid recognizes plugging/unplugging events, there's a command line tool called "acpi_listen". Run it and plug/unplug your charger to see how the corresponding events are named.

The hard part is to figure how to change display brightness on command line. I don't know if a user-friendly hardware-independent frontend exists, but you should be able to directly turn the knobs in sysfs... Usually there's a file in sysfs that lets you control brightness simply by writing the desired value to it. Take a look at the subfolders of /sys/class/backlight. There's a description of the sysfs backlight interface in the Ubuntu Wiki.

With this information you should be able to write short shell scripts that set brightness. Put them in /etc/acpi and write an EventScript similar to what people did in the acpid article on thinkwiki for other tasks.

3
  • Here's an AskUbuntu answer covering adjusting the Brightness via the command line. askubuntu.com/questions/149054/…
    – Merri
    Jul 1, 2013 at 12:02
  • Thanks for the replies, but I either don't get something or it doesn't contain the items I need.
    – user157554
    Jul 1, 2013 at 18:23
  • Forget to say: it does recognize plugging and unplugging, as well as changing brightness by using the dedicated keys. When plugged in it says "ac_adapter ACAD 00000080 00000000", when unplugging "battery BAT1 00000080 00000001", when using the keys to change brightness manually it says "video LCD 00000086 00000000"
    – user157554
    Jul 1, 2013 at 18:29
1

Try laptop-mode-tools. it's in Ubuntu repositories. after installation go to /etc/laptop-mode/conf.d/lcd-brightness.conf and change parameters according to your need.

For example:

CONTROL_BRIGHTNESS=1

BATT_BRIGHTNESS_COMMAND="echo 25"
LM_AC_BRIGHTNESS_COMMAND="echo 40"
NOLM_AC_BRIGHTNESS_COMMAND="echo 40"
BRIGHTNESS_OUTPUT="/sys/class/backlight/acpi_video0/brightness"

This is my actual settings on my Sony SVF13N17PGB Ultrabook.

Please change BRIGHTNESS_OUTPUT to proper path according to your notebook. You can find a good explanation in the config file itself.

You must log in to answer this question.