Giter VIP home page Giter VIP logo

battery-checker's Introduction

Battery Checker

Problem

My macbook is often in the "charging" state but is actually not charging, and sometimes I just forget to plug in my charger ๐Ÿคฆ This causes my laptop to run out of battery while I'm playing video games such as Steam or League of Legends ๐Ÿ˜ญ

Solution

Laptop will say "battery is draining" if the battery is not increasing, and will say "charger is not plugged in" if you didn't plug in your charger.

Done via a long-running script that can be run as a background process.

How to use

Assumes you're familiar with opening and running commands in the terminal.

To run as a background process:

nohup ./batteryd.py >/dev/null 2>&1 &

Configs you can set:

โฏ ./batteryd.py --help
usage: batteryd.py [-h] [-a APPS] [-s SECONDS_BETWEEN_CHECKS]

optional arguments:
  -h, --help            show this help message and exit
  -a APPS, --apps APPS  only run battery checks when any of these are opened,
                        separate each app with "|". e.g. Steam|LeagueClient
                        (default: None)
  -s SECONDS_BETWEEN_CHECKS, --seconds-between-checks SECONDS_BETWEEN_CHECKS
                        seconds between battery checks (default: 10)

e.g.

nohup ./batteryd.py --apps 'Steam|LeagueClient' --seconds-between-checks 30 >/dev/null 2>&1 &

To check if the background process is running:

ps -ax | grep 'batteryd.py'

To kill the background process:

kill <pid from the ps cmd>

How it works

Read code at batteryd.py or can ask me.

Limitations

  • Only works for macOS
  • Not friendly for people not familiar with the terminal
    • It's possible create this as a macOS app instead... ๐Ÿค”

battery-checker's People

Contributors

nickwu241 avatar

Stargazers

Tai Meng avatar  avatar

Watchers

James Cloos avatar  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.