Skip to content

michal-josef-spacek/Battery

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Battery

image

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

Features

  • Changes color to reflect battery status (Green, Yellow, Red)
  • Displays battery percentage
  • Graph bar changes its values between 0 and 100% (thanks to spark)
  • If you don't like the default colors, you can specify the good, medium and warning battery status colors using flags (read usage).

Requirements

Right now, battery requires Spark to graph your battery status, and only runs on Mac OS X.

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

Install

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 spark (with Homebrew on Mac OS X)

    brew install spark

  • Copy battery somewhere in your path & fix permissions

    sudo cp battery /usr/bin

    sudo chmod 755 /usr/bin/battery

Usage

Terminal

  • Run Battery (From the terminal)

    battery

You should see something like this:

image

tmux

  • Be sure to make tmux display utf-8 characters by running it with the -u flag

    tmux -u

  • Add the following line to your ~/.tmux.conf file

    set -g status-right "#(/usr/bin/battery -t)"

  • reload the tmux config by running tmux source-file ~/.tmux.conf.

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

image

Flags

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.

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 100.0%