Battery life indicator?

Are there any programs for X (for KDE would be great, something that sits in the Panel) that display the current charge of a laptop's battery? It would be great to know how long until my laptop dies...I used it with just the battery today for the first time ever...got about 2 hours out of the battery (as opposed to barely a half an hour when I used to run XP) but when it was drained, the system just shut off on me...I had no idea how much life the thing had left in it.
 
I don't know any GUI applications for this, but you can check it with sysctl:

Code:
% sysctl hw.acpi.battery
hw.acpi.battery.life: -1
hw.acpi.battery.time: -1
hw.acpi.battery.state: 7
hw.acpi.battery.units: 1
hw.acpi.battery.info_expire: 5

...although my values are currently -1 since I don't have my battery plugged in.
 
Hello,

In the default gnome install there is. The small blue Power Manager icon in the system tray.

It is exactly not KDE though soz!
 
Code:
$ sysctl hw.acpi.battery
sysctl: unknown oid 'hw.acpi.battery'
:(

I have to disable ACPI because the network card won't work with it enabled (stupid Acer). Also, Gnome won't build on my system, and fails to install via ports. Ah well...is there any other method?
 
Not that I'm aware of, and even if you could get Gnome installed, it's my guess that it's using ACPI as well.
 
as far as I recall, before the battery icon was working (FreeBSD 7.0 i think) I used to use...

acpi -i

or

apm

I cannot quite remember their exact usage, but they both allowed me to output my battery status to the console

If you want that displayed in X, it would be quite easy to make a simple gtk / qt dialog and scrape the data from the console output.
 
kpedersen said:
If you want that displayed in X, it would be quite easy to make a simple gtk / qt dialog and scrape the data from the console output.

echoing the output to something like dzen2 is even simpler. This is what I use to see my battery life in my xmonad status bar.
 
Hrm...

Code:
fbsd# apm
apm: can't open /dev/apm: No such file or directory
fbsd# acpi
acpi: Command not found.

:(

I'll try klaptopdaemon, thanks for the tip. :)
 
Code:
$ acpiconf -i0
acpiconf: /dev/acpi: No such file or directory
:(
Code:
$ xbattbar
This is xbattbar version 1.4.2, copyright (c)1998-2001 Suguru Yamaguchi
xbattbar: fall back to apm interface
xbattbar: cannot open apm device
:( :(
stupid Acer...
 
Might try rebuilding your kernel with
Code:
device apm
(I believe this is i386 only).

And good luck. I don't recall apm working all that well in the 4.x days and I don't know if that code has been updated much since then.
 
Hrm ok...thanks for all the help folks. I'm not a fan of beta-quality software, especially when it's an operating system, so I'll just chill until 8.0 is considered CURRENT, then upgrade. :)
 
Eponasoft said:
Hrm ok...thanks for all the help folks. I'm not a fan of beta-quality software, especially when it's an operating system, so I'll just chill until 8.0 is considered CURRENT, then upgrade. :)

Uh... 8 is -CURRENT. :p

(Or maybe it's 9 now?)
 
In FreeBSD, 'CURRENT' == 'bleeding edge - high risk'. Pick -RELEASE for production, -STABLE for 'some risk, but usually ok'.
 
Oops, my bad...whatever the word is for "recent, most stable, not likely to go crash" hehe. :) I guess that would be RELEASE. All the different descriptors are kind of confusing. :(
 
Code:
$ ./battray.py
Traceback (most recent call last):
  File "./battray.py", line 103, in <module>
    exec("import %s as p" % sys.platform)
  File "<string>", line 1, in <module>
  File ".//platforms/freebsd7.py", line 15, in <module>
    o = subprocess.Popen(['apm', '-ablt'], stdout=subprocess.PIPE).communicate()[0]
NameError: name 'subprocess' is not defined

:(
 
Code:
$ ./battray.py
apm: can't open /dev/apm: No such file or directory
Traceback (most recent call last):
  File "./battray.py", line 130, in <module>
    exec("import %s as p" % sys.platform)
  File "<string>", line 1, in <module>
  File ".//platforms/freebsd7.py", line 18, in <module>
    (ac, charging, percent, time) = o.split()
ValueError: need more than 0 values to unpack
Python isn't my thing so I don't know anything about how to fix it. :)
 
Back
Top