2008-03-07

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:
CMB0
BAT1
BAT0
...etc

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.

6 comments:

  1. 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

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

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

    ReplyDelete
  4. "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!!!

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

    ReplyDelete