ZBatt

A Legend of Zelda inspired health-bar battery meter for Shell prompts and Taskbars
Supported Platforms
Linux
Kernels >= 2.6.24 are supported; support for older kernels is not a priority.
UNIX
BSD is well supported; as long as you have sysctlbyname you should be fine.
Solaris support is still fairly new and experimental, but as long as you have sys/pm.h you should be good.
UNIX systems supported:
- DragonFlyBSD
- FreeBSD
- OpenIndiana (Solaris)
UNIX systems probably supported:
- NetBSD
- Midnight BSD
- OpenSolaris
- (Anything based on FreeBSD)
UNIX systems unsupported:
- OpenBSD
- SmartOS (Solaris)
Windows
Windows XP and later.
Runtime Dependencies
Linux and UNIX
- Python (GUI)†
- GTK+3 (GUI)‡
- PyGObject (GUI)
† Python v2.x.xx is no longer supported
‡ Support for GTk+2 might be added back in future releases
Windows
Windows provides everything you'll need.
Make Dependencies
- GNU Autotools (i.e. automake, autoconf)
- Make
Linux and UNIX
- C99 compliant C compiler
- Cython (GUI)
- pkgconf (GUI)
Windows
- C++11 compliant C++ compiler
Building
autoreconf -fi./configuremake
Installing
make DESTDIR="<DIR>" install
If the install fails because of permissions, try running it with sudo.
Alternatively, you can also just place the binaries zbatc, zbatt, and (if you built the GUI) gzbatt where ever you like.
Examples
The command-line is extremely flexible, so while there are defaults there's nothing stopping you from defining your own experience.
Git-esque
./zbatc -c 32; ./zbatt -r -f +; ./zbatc -c 31; ./zbatt -x -e -To make it even easier to integrate ZBatt with your current command-line experience, I've gone ahead and provided examples for some shells.
Zsh
PROMPT="%{$(./zbatc)%}$(./zbatt)%{�[0;0m%} %m%# "
## run TRAPALRM every $TMOUT seconds
TMOUT=60 # refresh the terminal prompt every 60 seconds
TRAPALRM ()
{
zle reset-prompt # refreshs the terminal prompt
}Bash
PS1='\[$(./zbatc)\]$(./zbatt)\[\033[0;0m\] [\h \W]\$ 'Mksh (Korn Shell)
PS1=$'$(./zbatc)'$(./zbatt)$'\033[0;0m'\ ["$(hostname)"]\Tcsh
set prompt="%{`./zbatc`%}`./zbatt` %{\033[0;0m%}%m "Notes
Zsh
As long as you use the TMOUT and TRAPALRM/zle reset-prompt stuff, your Zsh prompt should refresh itself every 60 seconds.
Bash
AFAIK there is no way to periodically refresh a bash prompt without either running clear/Ctrl-L or pressing enter, which causes the prompt to be redrawn.
Submissions
Screenshot, command-line prompt examples, and all other submissions are appreciated as always. Thank you.

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.





