5

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?

rubo77
  • 32,486

1 Answers1

2

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