reduce Screen brightness in battery mode automatically

I found the solution:

If you have laptop-mode-tools installed

cat /sys/class/backlight/acpi_video0/brightness
cat /sys/class/backlight/acpi_video0/max_brightness
sudo -H gedit /etc/laptop-mode/conf.d/lcd-brightness.conf

Contents should be:

DEBUG=0
CONTROL_BRIGHTNESS=1
BATT_BRIGHTNESS_COMMAND="echo [min value]"
LM_AC_BRIGHTNESS_COMMAND="echo [max value]"
NOLM_AC_BRIGHTNESS_COMMAND="echo [normal value]"
BRIGHTNESS_OUTPUT="/sys/class/thermal/cooling_device0/cur_state"

Sources:

  • Arch Wiki: laptop-mode-tools
  • Gentoo forum

  1. Download and install Cuttlefish
    This tool helps in a lot of stimulus based reactions.
  2. Install xbacklight
    sudo apt-get install xbacklight
    This tool helps in changing brightness via command line.
    Now make a file(say dim) with following content:
    #!/bin/bash
    xbacklight -set 10

    This command reduces your brightness to 10%.
    Change the mode of the file:chmod +x dim
  3. Open the Cuttlefish application(using dash) and add a new reaction.Add a new stimulus Power Cable Unplugged from the Hardware category.

Cuttlefish

Next you need to set up the reaction.Go to Reaction>Applications>Start Application(Advanced Mode)

Set Application

Now choose the executable as dim(file that we created earlier)
Set Application

You may also want to increase the brightness when power is plugged again.For that follow the same steps except write xbacklight -set 100 and change stimulus to Power Cable Plugged In.

To make it work, you need to enable cuttlefish to start automatically. Go to edit/preferences (within cuttlefish) and enable start up .