Home

Awesome

Battery

image

Battery is a little bash script that uses Spark to display the battery status on your tmux sessions or the terminal.

Features

Requirements

Right now, battery requires Spark to graph your battery status. Battery can run on both Mac OS X and Linux.

If you don't want to use Spark, you can use the -a flag, for ascii output: image

Install - Mac

Homebrew

Just do (case sensitive)

brew tap Goles/battery
brew install battery

One Liner

(Cut & Paste on terminal to install on /usr/bin, btw, try to run from ~/ or other writable dir)

brew install spark; curl -O https://raw.github.com/Goles/Battery/master/battery ; \
sudo mv battery /usr/bin; sudo chmod 755 /usr/bin/battery

Step by Step

Install - Linux

Linux support is still being tested. It ought to work properly in Debian and Ubuntu, but is largely untested in other distributions. Using linux requires upower, which should be included, or available, on most linux distributions.

It's recommended to install this somewhere in your path that is writable, like /usr/local/bin

# if you also want to use spark
curl -O https://raw.githubusercontent.com/holman/spark/master/spark
mv spark /usr/local/bin
chmod u+x /usr/local/bin/spark

curl -O https://raw.githubusercontent.com/goles/battery/master/battery
mv battery /usr/local/bin
chmod u+x /usr/local/bin/battery

NOTE: This spark is not the same spark that you would install by doing

$ sudo aptitude install spark

That is Apache Spark, which is a general engine for large-scale data processing.

Usage

Terminal

You should see something like this:

image

tmux

You should now see something like this at the bottom right corner:

image

Flags

The flag -b will set a different battery path, the default value is /sys/class/power_supply/BAT0. You can specifiy the colors for good battery level, middle battery level, and warning battery level with the flags -g -m -w. Note: You should use color names for when in tmux mode and ascii colors in terminal mode. In Mac OS, you can specify to use pmset with the -p flag; without it, the program uses ioreg. In Linux, this flag is ignored, and always uses upower.

Battery displays an emoji by default. You can disable this behaviour by passing the -e flag.

The flag -z will add zsh escape characters to the output of the script.