Using your laptop while it's charging is certainly not the best practise.
If your device doesn't support setting thresholds to limit the battery levels while charging and you're looking for something that serves a similar purpose, then you're at the right place.
Estimates the time required to charge the battery to the given threshold (defaults to 80%).
Then puts your device to sleep (it uses rtcwake
behind the scenes).
When the battery charges to the limit specified, the device is woken up and an alarm is played.
git clone https://github.com/helium18/bwake.git
cd bwake
chmod +x bwake
Copy the script to some desired location. Preferably somewhere in the $PATH
- It's just an estimate, there's a high chance that it'll go above / below the threshold a bit ~ 5%-10%. This can be controlled by setting the
precision
flag. - Consider running the script with
sudo
. (To avoid entering the password manually every time before the device is slept) - The alarm should be named
sound.ogg
and be placed in$HOME
. An option to override this behavior will be provided in the future
Feature requests and bug reports are welcome.