Git Product home page Git Product logo

thinkpattery's Introduction

thinkpattery

A program for tracking battery usage, remaining time, and health.

Important info

This program is intended specifically for use with Polybar because it just prints data to stdout. Additionally, while I created it to be used on Thinkpads (hence the name), I think it should work on just about any Linux laptop. I'm still pretty new to Linux and C, so don't quote me on that. The only thing that makes it designed for Thinkpads is that it finds multiple battery directories in /sys/class/power_supply and sums all their relevant energy info rather than only using a single battery like the default Polybar module does. However, it has additional functionality that the default module doesn't have, so it may still be worth using even with only 1 battery.

Installation

To create and install the binary, just run the following from the top-level directory:

make
install -m 755 thinkpattery /path/to/installation

I like to install mine at ~/.local/bin but it's up to you.

Configuration

Because I'm pretty new to C, configuration for this program is pretty limited and annoying to do. Most configuration-related variables are either a global const string or a macro. All icon consts can be found in battery_tracker.c, the macro for the exponential moving average alpha value can be found in moving_average.h (read about what changing the alpha value does here), and the update frequency macro (SAMPLE_FREQUENCY) can be found in common.h. All icons that I use are from Fontawesome, so you can either install that and use them as well or use your own icons.

thinkpattery's People

Contributors

bday-boy avatar

Watchers

 avatar

thinkpattery's Issues

Battery information becomes more inaccurate over time

I noticed while doing some code cleanup that the battery percent value from my cargo run testing and the value printing in Polybar itself were slightly off. I'm assuming something goes wrong with the tracker and battery energy gets more inaccurate as time goes on or something.

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.