Realtime updates aren't practical for a CLI, with the exception of a program running in the foreground (eg. top). In that case, the prompt would not be available. Furthermore, battery life is measured in hours so realtime reportings would be excessive. I'm talking about each new prompt displaying the most recent statistics.
Another scenario would be writing warning to the console when a threshold has been reached (eg. shutdown).
I believe we have a mis-communication here, so I will clarify my aforementioned position.
Yes, you are correct that CLI updates are not practical for the prompt. (You can run realtime code in the background -- stats/metrics gathering etc. -- with an output to a real-time front end user application, obviously.)
You *can* rewrite the prompt, though if you note I was making the point that it would severely hinder one's progress, and therefore would be, as you state, impractical.
I believe you are mistaken as to the measurement of battery life; it is not merely measured in hours, instead there are quite a few data points one can extract from the apm command interface.
tulku# apm
APM version: 1.2
APM Management: Disabled
AC Line status: on-line
Battery status: charging
Remaining battery life: 96%
Remaining battery time: unknown
Number of batteries: 2
Battery 0:
Battery status: charging
Remaining battery life: 100%
Remaining battery time: 0:00:00
Battery 1:
Battery status: not present
Resume timer: unknown
Resume on ring indicator: disabled
APM Capabilities:
unknown
tulku#
- tulku# apm
- APM version: 1.2
- APM Management: Disabled
- AC Line status: on-line
- Battery status: charging
- Remaining battery life: 96%
- Remaining battery time: unknown
- Number of batteries: 2
- Battery 0:
- Battery status: charging
- Remaining battery life: 100%
- Remaining battery time: 0:00:00
- Battery 1:
- Battery status: not present
- Resume timer: unknown
- Resume on ring indicator: disabled
- APM Capabilities:
- unknown
- tulku#
-
Now I have it disabled on this laptop in favor of ACPI, however, if it was enabled there would be even more information that what is showing. It's a simple matter to parse through with an awk and use whichever output one desired in whatever capacity one desired.
I am not sure which laptop you have, but both of mine chew through battery power like a 9 year old through a bag of cookies. I can watch my battery monitor in KDE show the life drain away while in the airport in no time flat.
If you wanted to send console messages, it would be simple enough to cron up an hourly check, or run a daemon that monitored for threshold, then posted. When I do use X, I have the graphical battery monitor, and I rarely use a console on my laptop/desktop systems. I have some custom monitors in place for security issues which notify me in other ways, so I never felt the need for a 'console' window.
Cheers.
"It's always a long day, 86,400 won't fit into a short."