2024-01-03 09:59:30 +01:00
|
|
|
# utility-charge-notifier
|
|
|
|
|
2024-01-03 10:06:21 +01:00
|
|
|
Utility script to poll battery state and show a message outside configured thresholds.
|
|
|
|
|
|
|
|
The script is configurable and uses an interval and lower/upper threshold for battery.
|
|
|
|
|
|
|
|
The script utilizes libnotify to send a system message when outside the limits - thus ensuring you don't forget to plug or unplug your laptop charger.
|
|
|
|
|
|
|
|
## Script
|
|
|
|
|
|
|
|
Create the local bin folder
|
|
|
|
|
|
|
|
```
|
|
|
|
mkdir ~/.local/bin
|
|
|
|
```
|
|
|
|
|
2024-01-03 10:09:05 +01:00
|
|
|
Copy the main script to your local bin folder and ensure it is executable
|
2024-01-03 10:06:21 +01:00
|
|
|
|
|
|
|
```
|
2024-01-03 10:09:05 +01:00
|
|
|
chmod +x ~/.local/bin/charge-notify.sh
|
2024-01-03 10:06:21 +01:00
|
|
|
```
|
|
|
|
|
|
|
|
## Usage
|
2024-01-03 10:09:05 +01:00
|
|
|
The battery levels are example levels.
|
|
|
|
|
|
|
|
Modern batteries is usually best when kept above 10% and below 60%.
|
|
|
|
|
2024-01-03 10:06:21 +01:00
|
|
|
Edit the battery levels according to your system and preference.
|
|
|
|
|
|
|
|
## Run script as a user service
|
|
|
|
Create user service to to execute the script after startup
|
|
|
|
|
|
|
|
Create the folder ~/.config/systemd/user
|
|
|
|
```
|
|
|
|
mkdir ~/.config/systemd/user
|
|
|
|
```
|
|
|
|
Copy the service definition `charge-notifier.service` the new folder
|
|
|
|
|
|
|
|
```
|
|
|
|
systemctl --user enable --now charge-notifier.service
|
|
|
|
```
|