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