Remember screen brightness settings in Ubuntu and Linux Mint

Screen brightness is an attribute that is reset automatically upon rebooting your machine on Ubuntu and all its fellow distributions. Lucky you if you find the settings okay, but on notebooks and similar machines, you might want to lower the brightness, you it doesn't suck your batteries dry.

To do that, open the following file as root via terminal:

sudo gedit /etc/rc.local

In there, enter the following line somewhere before the very last one that says "exit 0":

echo 0 > /sys/class/backlight/acpi_video0/brightness

0 is the lowest brightness setting. You can adjust it to your likings!

Troubleshoot and Improve power usage on Windows 7

Windows 7 has a troubleshooter taking care of power usage for notebooks as well as for desktop computers, it is quite hard to find however since you won't find it in your Control Panel's Power Options section. To access it,

- open the Control Panel and enter System and Security.
- In the topmost Action Center section, select Troubleshoot common computer problems.
- In the last menu entry, System and Security, select Improve power usage.

By clicking on Advanced, all problems found will automatically be corrected. You start the process by clicking on Next - if there have been problems they will be displayed along with a notice if they have been corrected or not. Click on Detailed information to view all the points that the troubleshooter has messed with or not:

Show battery capacity for notebooks on Windows

Notebook batteries lose part of their capacity over time depending on their treatment. To see at how much maximum capacity your battery it, there is a command line tool that you can use from an elevated command line. To open such, search your main menu for cmd, right-click it and choose Run as administrator. In the command line, enter following:

powercfg -energy

The tool will then observe the system for 60 seconds and will then save an energy report in the default location if not specified otherwise, which is C:\Windows\System32\. You will not be able to open from there so just drag and drop it to the desktop or some other none-system folder. Somewhere near the middle of the document you will find the battery information. Mine look like this:

Battery:Battery Information
Battery ID 206SANYODell
Manufacturer SANYO
Serial Number 206
Chemistry LION
Long Term 1
Design Capacity 93240
Last Full Charge 85892

The ratio of the last two values is the current capacity of your battery:
85892 / 93240 = 0,921
which is about 92% capacity.

Change to classic skin when unplugging notebook from power source in Windows

Windows 7 comes with the Aero skin by default which might look nice but consumes a great deal of resources - and with them, power. I have experienced a loss of up to two hours of battery life on my notebook when turning Aero on which one can get back by switching to the classic skin - that ugly gray one, that was used in the times before Windows XP.

It would be great if Windows provided an option to set a scheduled task to trigger on plugging or unplugging the power supply or to configure the power settings to change themes automatically but unfortunately we don't have that luxury, so we have to do it ourselves, in a slightly less elegant way.

What you need is a small VBScript which you can find here and a PowerShell script which checks in what state the notebook battery is in. To create that script, open a new notepad and paste the following into it:

$sav = (Get-WmiObject -Class Win32_Battery -ea 0).BatteryStatus
while ($true)
start-sleep -s 5
if (((Get-WmiObject -Class Win32_Battery -ea 0).BatteryStatus -eq (1 -or 3 -or 4 -or 5 -or 10 -or 11)) -and ((Get-WmiObject -Class Win32_Battery -ea 0).BatteryStatus -ne $sav))
& 'C:\Windows\Resources\Ease of Access Themes\Classic.theme'
$sav = (Get-WmiObject -Class Win32_Battery -ea 0).BatteryStatus
if ((Get-WmiObject -Class Win32_Battery -ea 0).BatteryStatus -ne $sav)
& 'C:\Windows\Resources\Themes\Aero.theme'
$sav = (Get-WmiObject -Class Win32_Battery -ea 0).BatteryStatus

Adjust the paths printed bold to the location of the themes you want to use if you want different ones (the first one is the one that is applied on unplugging the supply, second is for replugging). Save the script as a .ps1 file. If you haven't yet created the VBScript, do it now following the above link. Remember to adjust the path to the ps1 script used there to yours. If you now launch the VBScript the PowerShell script should be started silently. If you get an error or the script won't start, you first have to configure your system to allow executing PowerShell scripts - see the instructions below the code provided here.

The locations of the themes are
C:\Windows\Resources\Ease of Access Themes for the classic styled themes.
C:\Windows\Resources\Themes for preconfigured Aero style themes and
C:\Users\[YourUsername]\AppData\Local\Microsoft\Windows\Themes for custom themes (the AppData folder is hidden by default).

To automate everything you can set the execution of your VBScript as a scheduled task. Do so by entering Task Scheduler into your Start-menu search bar. Set up the task for execution on start up if you want it to be run on every session.