Git Product home page Git Product logo

battstat's Introduction

Battstat is a simple battery monitor that I wrote for use with dwm and dunst, though it should be easy enough to use it with other window managers and notification daemons. It reports the status of the battery continuously, and provides low battery notifications via the notification daemon.

Building

make

Installing

cp battstat $somewhere_in_your_path

Usage

When run, Battstat repeatedly outputs the status of the battery. It will look something like:

Charging (51%)

Or

Discharging (32%), 1:05:23

A new status line should come in roughly once per second. In my case, I have the following in my .xinitrc:

battstat | while read battinfo; do
    xsetroot -name "$(show-weather.sh) | $battinfo | $(date +'%a %d %h, %I:%M %p')"
done &

Which puts the battery status, along with some other information, in the dwm status bar (which just displays the root window's name). If you're using another window manager, you will have to find your own way to display the status.

Battstat will also emit two warnings to the running notification daemon (if any), When the battery has less than 20 minutes remaining, and again when it has less than 5 minutes remaining. It's worth noting that Battstat does not link against libnotify, rather it invokes the notify-send command to send messages instead (The libnotify api is much more complex to use than the cli).

License

ISC, see COPYING.

battstat's People

Contributors

zenhack avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.