Ubuntu – Battery indicator doesn’t change its status (but after reboot)

12.04batteryindicator

The problem is the same as here:

  1. The icon does not change when the power cord is plugged in or
    unplugged (the icon remains a battery if that was the power source on
    boot but won't change if I plug in the power adaptor and visa-verse).

  2. The battery indicator does not give me a low battery warning or alert
    (ubuntu just shuts down with no onscreen warnings).

Info:

  • I use Ubuntu 12.04 LTS, 64 Bit
  • Reinstalling gnome-power-manager didn't work
  • acpi -b returns "Battery 0: Unknown, 95%"

Best Answer

This might be a little weird better answer if your problem is still not solved. I wrote a small python script to show the battery status and its percentage. But the only problem is that you need to run the script every time you need to see the status.

from subprocess import Popen,PIPE
process=Popen(['upower','-i','/org/freedesktop/UPower/devices/battery_BAT0'],stdout=PIPE)
process1=Popen(['grep','-E','state|to\ full|percentage'],stdin=process.stdout,stdout=PIPE)

answer=process1.stdout.read().split('\n')
answer.pop()
final=[]
for i in range(len(answer)):
    temp=answer[i].split(':')
    final.append(temp[0].strip(' ')+' : '+temp[1].strip(' '))

string=''
for i in final:
    string+=i+'\n
string=string.strip('\n')

Popen(['notify-send',string])
Related Question