Project

batt

0.0
No commit activity in last 3 years
No release in over 3 years
Read basic information about your laptop's battery. Includes both ANSI and tmux colour support.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
>= 0
>= 0
>= 0

Runtime

~> 0.5
>= 0
 Project Readme

Batt

Read the battery status from your laptop. Designed to be used in tmux's status line.

Currently only supports OSX.

Dude I was just realizing I basically cannot live without batt now... it is dope -- Rich Soni

Installation

Add this line to your application's Gemfile:

gem 'batt'

And then execute:

$ bundle

Or install it yourself as:

$ gem install batt

Usage

There is a full API that I'm working on, but it's not complete. Gem docs will come at the time that the code is implemented.

You can use the commandline program, in OSX only for now:

batt <action>

Where action is one of the following:

  • all -- prints out all status of the battery
  • status -- 'charging' or 'discharging'
  • source -- 'AC Power' or 'Battery Power'
  • remaining -- amount of time remaining til complete discharge or complete charge
  • capacity -- a percentage of how charged the battery is

tmux

Tmux support is a work in progress and is one of the primary use-cases for the design of this gem. Currently, only the capacity action has tmux support, which can be enabled via passing --tmux to it:

batt capacity --tmux

Future releases will have additional support for tmux. I just need to work out what it's gonna look like.

Example tmux.conf

Example tmux status line configuration. Add this to your .tmux.conf:

set-option status-right-length 120
set-option status-right "[ #(batt source) #(batt capacity --tmux) ] #(date \"+%Y-%m-%d %H:%M\")"

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request