Ubuntu: Automatically dim brightness if battery is low



Question:

In Ubuntu 14.04 there is no option in the energy settings what to do when the battery is low. There is only a setting for action when critical.

I would like to automatically dim the brightness on my laptop when the battery reaches a low level.

Is there a hidden setting for this?


Solution:1

This script works for me for doing exactly this. The drawback is that it will continue to set the brightness level even after increasing it manually, when the battery is low, and it does not check if the ac adaptor has been connected.

/etc/acpi/events/battery_changed

event=battery.*  action=/etc/acpi/actions/dim_screen_on_low_battery.sh  

/etc/acpi/actions/dim_screen_on_low_battery.sh

#!/bin/bash    BATTERY_LOC="/sys/class/power_supply/BAT0/"  VIDEO_LOC="/sys/class/backlight/acpi_video0/"    percent_left=$((100 * `cat /sys/class/power_supply/BAT0/charge_now` / `                         cat /sys/class/power_supply/BAT0/charge_full`))  #echo "$percent_left% battery remaining"  if [ $percent_left -lt 20 ] # Adjust the battery limit.  # Adjust the dimmed brightness level.  then echo 50 > /sys/class/backlight/acpi_video0/brightness   fi  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »