When i work in Kubuntu, KDE power management has a section that lets you automatically adjust display brightness according to battery percentage.
I want to know if there is a tool like that in Ubuntu 12.04?
thanks.
When i work in Kubuntu, KDE power management has a section that lets you automatically adjust display brightness according to battery percentage.
I want to know if there is a tool like that in Ubuntu 12.04?
thanks.
Here is a script that checks the remaining battery every minute and adjusts the brightness accordingly. However, once the battery is below 30%, it sets the brightness to 0.
#! /bin/bash while true do chargingState=$(grep "charging state:" /proc/acpi/battery/BAT0/state | awk '{print $3}') batteryFull=$(grep "design capacity:" /proc/acpi/battery/BAT0/info | awk '{print $3}') batteryRemaining=$(grep "remaining capacity:" /proc/acpi/battery/BAT0/state | awk '{print $3}') batteryPercentage=$((batteryRemaining * 100/batteryFull)) if [ $chargingState == "discharging" ] then if ((batteryPercentage > 30)) then xbacklight -set $batteryPercentage else xbacklight -set 0 fi fi sleep 60 done
Copy this text to some file, say batteryBrightness.sh
Make your script executable.
chmod +x /path/to/script
Note:
xbacklight
package installed, if you don't have it installed, install it by running the following command:sudo apt-get install xbacklight