Fix support for differing sysfs naming conventions

This fixes an issue where the battery constantly reads at 0%.

It's because (at least on my system) the naming conventions for the
special files inside the sysfs tree are different from what the script
expects.

The script expects:
 /sys/class/power_supply/BAT*/energy_full
 /sys/class/power_supply/BAT*/energy_now
 /sys/class/power_supply/BAT*/power_now

My sysfs has:
 /sys/class/power_supply/BAT*/charge_full
 /sys/class/power_supply/BAT*/charge_now
 /sys/class/power_supply/BAT*/current_now

Unfortunately I am unable to find the exact commit log where this naming
convention changed, but now the script will support both and everyone
will be happy.

This bug was also observed in kernel 2.6.38.7.

* Evidence *

$ uname -a

Linux delicious 3.2.2 #1 SMP Fri Jan 27 15:19:49 CST 2012 x86_64 Intel(R) Atom(TM) CPU N455   @ 1.66GHz GenuineIntel GNU/Linux

$ ls -la /sys/class/power_supply/BAT1/
total 0
drwxr-xr-x 3 root root    0 Feb  8 15:20 .
drwxr-xr-x 3 root root    0 Feb  8 15:20 ..
-rw-r--r-- 1 root root 4096 Feb 13 10:44 alarm
-r--r--r-- 1 root root 4096 Feb  8 15:20 charge_full
-r--r--r-- 1 root root 4096 Feb 13 10:44 charge_full_design
-r--r--r-- 1 root root 4096 Feb  8 15:20 charge_now
-r--r--r-- 1 root root 4096 Feb  8 15:20 current_now
-r--r--r-- 1 root root 4096 Feb 13 10:44 cycle_count
lrwxrwxrwx 1 root root    0 Feb 13 10:44 device -> ../../../PNP0C0A:00
-r--r--r-- 1 root root 4096 Feb 13 10:44 manufacturer
-r--r--r-- 1 root root 4096 Feb 13 10:44 model_name
drwxr-xr-x 2 root root    0 Feb 13 10:44 power
-r--r--r-- 1 root root 4096 Feb  8 15:20 present
-r--r--r-- 1 root root 4096 Feb 13 10:44 serial_number
-r--r--r-- 1 root root 4096 Feb  8 15:20 status
lrwxrwxrwx 1 root root    0 Feb  8 16:01 subsystem -> ../../../../../../class/power_supply
-r--r--r-- 1 root root 4096 Feb 13 10:44 technology
-r--r--r-- 1 root root 4096 Feb 13 10:33 type
-rw-r--r-- 1 root root 4096 Feb  8 16:01 uevent
-r--r--r-- 1 root root 4096 Feb 13 10:44 voltage_min_design
-r--r--r-- 1 root root 4096 Feb  8 15:20 voltage_now
Merge remote-tracking branch 'denilsonsa/master'
Eliminate redundant sysfs file existence checks.

Caveats: `'0' or 2` will return `'0'`

{power,current}_now can contain a 0 when charging. This is normal.
Mark icons non-executable.
Fix setup process.

I don't have DistUtilsExtra on my system, it's not part of vanilla python packaging.
Add script for warning and hibernating.

This is a simple script I wrote that will hopefully work on most distros
for:

A) Warning the user that the battery level is critical.
B) Automating the power state change process (optional, on by default).

Tested on Slackware 13.37 x86_64 with 3.2.7 vanilla kernel.
Tested with Xdialog 2.3.1 and xmessage 1.0.3.

To use with batterymon, start batterymon with the `--on-critical'
option pointed at this script.
Improve warning script.

Add -W flag for display-only operation. Hopefully this script will serve
as many needs as possible.
Merge remote-tracking branch 'jareksed/master'
Add license file to manifest.

'Nuff said.
Optimize icons for size using optipng(1).

Saves 5995 bytes, or 5.8 KB.
Fix portability issue re: `type' built-in usage

Replace with `which' which is not a built-in.
use python2 instead of plain python in shebang
Merge remote-tracking branch 'JarekSed/master'
reinitalize the number of AC adapters and batteries every once in a while
prevent losing state when reinitializing batteries and ac adapters
accumulate information form all ac adapters and batteries and join the results
Merge branch 'master' of https://github.com/h3xx/batterymon-clone
Merge branch 'master' of https://github.com/jceb/batterymon-clone