A Legend of Zelda like health-bar battery meter for Shell prompts and Taskbars
Kernels >= 2.6.24 are supported; support for older kernels is not a priority, but may be added later.
Most BSDs should be supported: as long as you have sysctlbyname
, you should be fine. BSD systems known to work:
- DragonFly BSD
- FreeBSD
BSD systems that should work:
- NetBSD
- Midnight BSD
- (Anything based on FreeBSD)
BSD systems known not to work:
- OpenBSD
- GNU Autotools
- C99 compliant C compiler
The GUI (Graphical User Interface) requires gtk2 and the configure
script will need pkg-config, but these are optional, since you can opt out of building GUI using the --without-gtk2
configure
flag.
autoreconf -i
./configure
make
Just place zbatc
(zbatt-color) and zbatt
(zbatt-text) where ever you want them and add the appropriate stuff to your terminal prompt.
./zbatc -c 32; ./zbatt -p -f +; ./zbatc -c 31; ./zbatt -m -e -
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.