https://github.com/meysampg/battery_notifier
Send an alarm to notification daemon if battery percentage become lower than a threshould
https://github.com/meysampg/battery_notifier
battery-percentage go linux-app notification
Last synced: 5 months ago
JSON representation
Send an alarm to notification daemon if battery percentage become lower than a threshould
- Host: GitHub
- URL: https://github.com/meysampg/battery_notifier
- Owner: meysampg
- License: mit
- Archived: true
- Created: 2018-08-09T06:10:55.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2023-02-05T16:44:37.000Z (over 2 years ago)
- Last Synced: 2024-12-16T23:22:56.942Z (6 months ago)
- Topics: battery-percentage, go, linux-app, notification
- Language: Go
- Homepage:
- Size: 29.3 KB
- Stars: 18
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Battery Notifier :battery:
This is a simple application to show current battery status (percentage and charging status). It can also watch the battery continuously and send periodic desktop notifications when the battery goes below a threshold percentage.## Development
Clone `https://github.com/meysampg/battery_notifier` and run `go mod vendor`.## Options :construction_worker:
* `-v`: show application version.* `-t`: battery percentage threshold, below which the battery will be condiered as *low* and the user will start getting desktop notifications about low battery.
* `-l`: battery check interval during low (< threshold) battery.
* `-n`: battery check interval during good/normal (> threshold) battery.
* `-w`: continuously watch battery level at preset interval. The interval depends on values of '-n' and '-l'.
* `-p`: show the remaining percentage of the battery and exit.
* `-h`: get help message and default values of flags/options.
## Creating a *Systemd Service* to keep watching battery even across reboots
* Copy the executable to /usr/local/bin/* Create a systemd service unit file like below:
```
$ cat /lib/systemd/system/battery-notifier.service
[Unit]
Description=System Battery Monitor and Notifier
After=multi-user.target[Service]
User=
ExecStart=/usr/local/bin/battery_notifier -w
Restart=on-failure
RestartSec=30s[Install]
WantedBy=multi-user.target
```* Save the above file and perform the following to always start the battery-notifier service:
```
$ sudo systemctl daemon-reload
$ sudo systemctl start battery-notifier
$ sudo systemctl enable battery-notifier
```