A Legend of Zelda inspired health-bar battery meter for Shell prompts and Taskbars
Kernels >= 2.6.24 are supported; support for older kernels is not a priority.
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.
- DragonFlyBSD
- FreeBSD
- OpenIndiana (Solaris)
- NetBSD
- Midnight BSD
- OpenSolaris
- (Anything based on FreeBSD)
- OpenBSD
- SmartOS (Solaris)
Windows XP and later.
- 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 provides everything you'll need.
- GNU Autotools (i.e. automake, autoconf)
- Make
- C99 compliant C compiler
- Cython (GUI)
- pkgconf (GUI)
- C++11 compliant C++ compiler
autoreconf -fi
./configure
make
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.
The command-line is extremely flexible, so while there are defaults there's nothing stopping you from defining your own experience.
./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.
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
}
PS1='\[$(./zbatc)\]$(./zbatt)\[\033[0;0m\] [\h \W]\$ '
PS1=$'$(./zbatc)'$(./zbatt)$'\033[0;0m'\ ["$(hostname)"]\
set prompt="%{`./zbatc`%}`./zbatt` %{\033[0;0m%}%m "
As long as you use the TMOUT
and TRAPALRM
/zle reset-prompt
stuff, your Zsh prompt should refresh itself every 60 seconds.
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.
Screenshot, command-line prompt examples, and all other submissions are appreciated as always. Thank you.