Giter Site home page Giter Site logo

paulgrammer / battery-reminder Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 7 KB

This program is a battery monitor for MacBook Pro users, which plays a sound alert when the battery percentage falls below a specified minimum threshold while discharging or rises above a specified maximum threshold while charging. The goal is to help users optimize their battery usage and extend the lifespan of their MacBook's battery.

Makefile 5.22% Go 59.61% Shell 35.17%
battery battery-information battery-level battery-life battery-management-system battery-monitor battery-percentage battery-status macbook macbook-pro macos

battery-reminder's Introduction

Battery Reminder

This is a simple Go program that reminds MacBook Pro users when the battery level is at 20% or 80% charge, to help prolong the battery life of the MacBook.

Purpose

The purpose of this program is to help MacBook Pro users optimize their battery usage and extend the lifespan of their MacBook's battery. By reminding the user when the battery level is at 20% or 80% charge, the user can avoid overcharging or completely discharging the battery, which can damage the battery and reduce its lifespan.

How to use

  1. Clone this repository to your local machine.

  2. Make sure you have Go installed on your machine.

  3. Open a terminal window and navigate to the directory where the program is located.

  4. Run the following command to build the program:

    make build
    
  5. Run the program using the following command:

    ./build/battery-reminder
    

    The program will run in the background and monitor the battery level of your MacBook Pro. It will remind you with a sound when the battery level is at 20% or 80% charge.

    You can customize the sound files by modifying the paths to the sound files in the main() function of the code.

Running as a background process

To run the battery-reminder program as a background process using nohup, you can follow these steps:

  1. Navigate to the directory where your battery-reminder program is located in a terminal window.

  2. Run the following command to start your program as a background process:

    nohup ./build/battery-reminder > battery-reminder.log &
    

    This command starts your program in the background and redirects its output to a log file named battery-reminder.log. The & at the end of the command sends the process to the background.

  3. To check the status of your program, you can run the following command:

    ps aux | grep battery-reminder
    

    This will show a list of all processes running on your system that contain the string "battery-reminder".

  4. To stop your program, you can find its process ID (PID) using the ps command, and then use the kill command to stop it:

    ps aux | grep battery-reminder
    kill PID
    

    Replace PID with the process ID of your battery-reminder program.

That's it! Your battery-reminder program should now run as a background process using nohup. Note that this method does not automatically start your program when your Mac starts up, and you may need to manually start it each time you want to use it.

Compatibility

This program has been tested on macOS, but it may work on other operating systems that support the battery package in Go.

Disclaimer

This program is not intended to replace the built-in battery monitoring tools provided by Apple or to provide medical advice. Always consult with a qualified professional before making any changes to your usage patterns or lifestyle.

License

This program is licensed under the MIT License. See the LICENSE file for details.

battery-reminder's People

Contributors

paulgrammer avatar

Stargazers

 avatar  avatar

Watchers

 avatar

battery-reminder's Issues

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.