wiki:Linux/Ubuntu/UdevRuleToDimLaptopPanelBacklight

UDEV Rule to Dim Laptop Panel Backlight

This is a simple rule that can be adapted for various video-hardware-specific back-light dimming methods. This particular one works with the  smartdimmer package to control many Nvidia chipsets, causing the back-light to adjust to 50% brightness when the charger is switched off and return to 100% brightness when the charger is switched on.

Create the file /etc/udev/rules.d/80-smartdimmer.rules:

# NVidia backlight control using smartdimmer
# Copyright July 2008, TJ <ubuntu@tjworld.net>
# Licensed under the GNU General Public License, v2

ACTION=="change", SUBSYSTEM=="power_supply", ATTR{type}=="Battery", ATTR{status}=="Discharging", RUN+="/usr/bin/smartdimmer -s 12"
ACTION=="change", SUBSYSTEM=="power_supply", ATTR{type}=="Battery", ATTR{status}=="Charging", RUN+="/usr/bin/smartdimmer -s 21"

To use it immediately reload the UDEV rules:

sudo udevadm control --reload_rules