By Ryan Reamsbottom

Maximizing battery life with laptop-mode-tools part 1

Laptop-mode-tools is an excellent set of tools designed to maximize battery life on your laptop. Among many features, it allows you to set the CPU governor (i.e. how fast your processor runs) and screen brightness. These are probably the two most important settings with regard to battery life.



In this article, I'll show you how to tweak the first one to maximize your battery life.

First of all, we have to install laptop-mode-tools. It's in the main repositories, so installation is pretty simple.  Open a terminal and type:

sudo apt-get install laptop-mode-tools

It'll ask for your password, and permission to install a couple of other small utilities. Now that we've got that accomplished, it's time to tweak the settings. I prefer to have maximum battery life, and so I use the "powersave" governor when on battery. When connected to power, I use the default "ondemand" governor. To change the setting for the CPU governor, we need to edit a file:

gksu scratch-text-editor /etc/laptop-mode/conf.d/cpufreq.conf

Scroll down to this line, and change it to:

BATT_CPU_GOVERNOR=powersave

Save the file, and then close Scratch.

For bonus points, use emacs in terminal mode.
A useful tool for checking and manually changing the current frequency of your processor is the cpufreq indicator. This will provide an icon in your panel that shows you the current state of your processor, and allow you to change governors. Install it:

sudo apt-get install indicator-cpufreq

Then we run it by clicking on Applications, and typing "indicator-cpufreq" and hit enter. You should see an icon in your panel. If you don't, right-click the Files icon in the dock, and click "New Window as Administrator."  Browse to /usr/share/icons/ubuntu-mono-dark/status/22/ and copy all images to /usr/share/icons/elementary/status/22/. Then restart indicator-cpufreq. If you want an easy way to do this, open a terminal and type:

killall indicator-cpufreq
sudo cp /usr/share/icons/ubuntu-mono-dark/status/22/indicator-cpufreq* /usr/share/icons/elementary/status/22/

indicator-cpufreq &

 Click it to see what the current governor is. Try unplugging the power cable and seeing if the governor changes. If it does, we've succeeded.

Part 2