Set the battery in conky correctly

Configure the battery at Conky can be a nightmare looking for this solution at web 'cus there isn't very information about it. I already had this problem...

ACPI battery number is given as argument, at 'funtions' battery, battery_bar and battery_percent. By default the argument is BAT0. But if it doen't work, let's find out the correct argument:

  • Open the terminal and type:
$ ls /proc/acpi/battery

  • There can be various kind of output:

My output was: CMB0

  • Open the .conkyrc file and edit to (examples):
${battery CMB0}
${battery_bar CMB0}
${battery_percent CMB0}

Obviously, replace CMB0 with the output you received earlier.


Srikanth said...

Great Post. Thanks.

To further help the readers:

You can identify which one is the right one by reviewing a file by name "info".

In the above example:

cat /proc/acpi/battery/CMB0/info
present: yes
design capacity: 5135 mAh
last full capacity: 5135 mAh
battery technology: rechargeable
design voltage: 14400 mV
design capacity warning: 257 mAh
design capacity low: 52 mAh
capacity granularity 1: 100 mAh
capacity granularity 2: 100 mAh
model number: Primary
serial number: 44718 2008/01/24
battery type: LIon
OEM info: Hewlett-Packard

uterrorista said...

Thanks for the info! :)

Ernesto said...

Just what I was looking for! Thanks for the post.

Anonymous said...

Just an update for those in 2011, using Arch Linux I found the battery info in /sys/class/power_supply/

Brantley Scism said...

"Jason.Rodriquez said...
Just an update for those in 2011, using Arch Linux I found the battery info in /sys/class/power_supply/"

I cannot thank you enough, I have been searching all day for this answer. THANK YOU!!!

muthuh said...

I found it the same place in debian too, thanks Jason

Kale Co Jakim said...

Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Java developer learn from Java Training in Chennai. or learn thru Java Online Training in India . Nowadays Java has tons of job opportunities on various vertical industry.