Code Monkey home page Code Monkey logo

power-guard's Introduction

power-guard

Built with Lisp License
ko-fi

A battery protector for mobile computers

Background

Continuing to use your computer when the battery charge is critically low could lead to serious damage to the battery. You may never face this issue while using operating systems like Windows, macOS, or even "ready-to-use" Linux distributions like Ubuntu and Fedora. However, for minimal setups like Arch, Void, and similar distributions, you may have to be careful about the battery charge as there's mostly nothing in place to take care of it on your behalf.

power-guard provides a simple command to fill in the gap by keeping a watch over the remaining battery charge and automatically suspending (or hibernating) your system to protect your battery from damage. You may also run it as a service with supported init systems.

Suspend vs Hibernate

power-guard usually prefers suspend over hibernate, but performs the latter when there is more than one battery equipped. This could be handy in the absence of charging points nearby and the user can quickly swap the discharged battery with a charged one and resume working without turning the computer off.

Installation

There are a few different ways to get power-guard.

Compile from source

# Clone project to the local workspace
git clone https://github.com/myTerminal/power-guard.git

# Switch to the project directory
cd power-guard

# Install with `make`
make install

Through a package manager

power-guard will soon be available to install from your operating system's package manager.

How to Use

A simple way to use power-guard is to run it in a command-line terminal with no command arguments.

power-guard

By default, it watches the remaining charge on the battery and suspends (or hibernates) the computer when it drops below 10%. You can also optionally specify the minimum threshold percentage of charge as an argument.

power-guard 7

The above example only suspends the computer when the remaining charge is below 7%.

Running as a service

power-guard can also be run as an init service, and currently only supports Runit. Support for more init systems will be implemented soon.

Further help with commands

To learn more about usage, refer to manpage:

man power-guard

Updating

In order to update power-guard, simply run:

power-guard-update

Uninstalling

In order to uninstall power-guard, simply run:

power-guard-uninstall

External Dependencies

Being written with Common Lisp, power-guard depends on SBCL. In most cases, it will be automatically installed while generating the binary, but if it doesn't please install it before running the installation.

The other required programs are as follows:

Optional External Dependencies

Below are a few more optional dependencies that are also attempted to be fetched during the installation:

If not installed automatically, you may install them manually.

To-do

  • Improve reading of battery level, add support for more hardware types
  • Implement alternate methods of suspending the system
  • Add support for more init systems like OpenRC, SysVinit, etc.

power-guard's People

Contributors

myterminal avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 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.