mirror of
https://github.com/actuallymentor/battery.git
synced 2026-02-03 14:03:24 +00:00
Merge branch 'actuallymentor:main' into main
This commit is contained in:
17
README.md
17
README.md
@@ -2,7 +2,6 @@
|
||||
|
||||
<img width="300px" align="right" src="./screenshots/tray.png"/>This tool makes it possible to keep a chronically plugged in Apple Silicon Macbook at `80%` battery, since that will prolong the longevity of the battery. It is free and open-source and will remain that way.
|
||||
|
||||
|
||||
> Want to know if this tool does anything or is just a placebo? Read [this excellent article](https://batteryuniversity.com/article/bu-808-how-to-prolong-lithium-based-batteries). TL;DR: keep your battery cool, keep it at 80% when plugged in, and discharge it as shallowly as feasible.
|
||||
|
||||
### Requirements
|
||||
@@ -12,7 +11,7 @@ This is an app for Apple Silicon Macs. It will not work on Intel macs. Do you ha
|
||||
### Installation
|
||||
|
||||
- Option 1: install through brew with `brew install battery`
|
||||
- Option 2: [You can download the latest app dmg version here]( https://github.com/actuallymentor/battery/releases/ ).
|
||||
- Option 2: [You can download the latest app dmg version here](https://github.com/actuallymentor/battery/releases/).
|
||||
- Option 3: command-line only installation (see section below)
|
||||
|
||||
The first time you open the app, it will ask for your administator password so it can install the needed components. Please note that the app:
|
||||
@@ -28,7 +27,6 @@ Do you have questions, comments, or feature requests? [Open an issue here](https
|
||||
|
||||
---
|
||||
|
||||
|
||||
## 🖥 Command-line version
|
||||
|
||||
> If you don't know what a "command line" is, ignore this section. You don't need it.
|
||||
@@ -47,7 +45,7 @@ curl -s https://raw.githubusercontent.com/actuallymentor/battery/main/setup.sh |
|
||||
|
||||
This will:
|
||||
|
||||
1. Download the precompiled `smc` tool in this repo (built from the [hholtmann/smcFanControl]( https://github.com/hholtmann/smcFanControl.git ) repository)
|
||||
1. Download the precompiled `smc` tool in this repo (built from the [hholtmann/smcFanControl](https://github.com/hholtmann/smcFanControl.git) repository)
|
||||
2. Install `smc` to `/usr/local/bin`
|
||||
3. Install `battery` to `/usr/local/bin`
|
||||
|
||||
@@ -68,7 +66,6 @@ After running `battery charging on` you will see it change to this:
|
||||
|
||||

|
||||
|
||||
|
||||
For help, run `battery` without parameters:
|
||||
|
||||
```
|
||||
@@ -145,10 +142,18 @@ This tool calls a number of urls, blocking all of them will only break auto-upda
|
||||
|
||||
All urls are called over `https` and so not leak data. Unidentified Analytics keeps track of unique ip addresses that open the app, but nothing else.
|
||||
|
||||
### What distinguishes this project from Optimized Charging?
|
||||
|
||||
Optimized Charging, a feature that is built into MacOS, aims to ensure the longevity and health of your battery. It does so by "delaying charging the battery past 80% when it predicts that you’ll be plugged in for an extended period of time, and aims to charge the battery before you unplug," as explained in [Apple's user guide](https://support.apple.com/en-ca/guide/mac-help/mchlfc3b7879/mac#:~:text=Optimized%20Battery%20Charging%3A%20To%20reduce,the%20battery%20before%20you%20unplug.).
|
||||
|
||||
Additionally, Optimized Charging uses machine learning to decide when the battery should be held at 80%, and when it should become fully charged. If your Mac is not plugged in on a regular schedule, optimized charging will not work as intended.
|
||||
|
||||
This app is a similar alternative to Optimized Charging, giving the user control over when it is activated, what percentage the battery should be held at, and more.
|
||||
|
||||
### How do I support this project?
|
||||
|
||||
Do you know how to code? Open a pull-request for a feature with the label [help wanted (PR welcome)](https://github.com/actuallymentor/battery/labels/help%20wanted%20%28PR%20welcome%29).
|
||||
|
||||
Do you have an awesome feature idea? [Add a feature request](https://github.com/actuallymentor/battery/issues/new/choose)
|
||||
|
||||
Do you just want to keep me motivated to update the app? [Tweet at me](https://twitter.com/actuallymentor)
|
||||
Do you just want to keep me motivated to update the app? [Tweet at me](https://twitter.com/actuallymentor)
|
||||
|
||||
@@ -4,7 +4,7 @@ const { exec } = require( 'node:child_process' )
|
||||
const { log, alert, wait, confirm } = require( './helpers' )
|
||||
const { get_force_discharge_setting } = require( './settings' )
|
||||
const { USER } = process.env
|
||||
const path_fix = 'PATH=/bin:/usr/bin:/usr/local/bin:/usr/sbin:/opt/homebrew'
|
||||
const path_fix = 'PATH=/bin:/usr/bin:/usr/local/bin:/usr/sbin:/opt/homebrew/bin:/opt/homebrew/sbin:/opt/homebrew'
|
||||
const battery = `${ path_fix } battery`
|
||||
const shell_options = {
|
||||
shell: '/bin/bash',
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
## Update management
|
||||
## variables are used by this binary as well at the update script
|
||||
## ###############
|
||||
BATTERY_CLI_VERSION="v1.1.5"
|
||||
BATTERY_CLI_VERSION="v1.1.6"
|
||||
|
||||
# Path fixes for unexpected environments
|
||||
PATH=/bin:/usr/bin:/usr/local/bin:/usr/sbin:/opt/homebrew
|
||||
PATH=/bin:/usr/bin:/usr/local/bin:/usr/sbin:/opt/homebrew/bin:/opt/homebrew/sbin:/opt/homebrew
|
||||
|
||||
## ###############
|
||||
## Variables
|
||||
@@ -424,9 +424,9 @@ if [[ "$action" == "adapter" ]]; then
|
||||
|
||||
# Set charging to on and off
|
||||
if [[ "$setting" == "on" ]]; then
|
||||
enable_discharging
|
||||
elif [[ "$setting" == "off" ]]; then
|
||||
disable_discharging
|
||||
elif [[ "$setting" == "off" ]]; then
|
||||
enable_discharging
|
||||
fi
|
||||
|
||||
exit 0
|
||||
|
||||
Reference in New Issue
Block a user