Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shouya/batry
Battery status monitor
https://github.com/shouya/batry
battery battery-monitor dbus status-bar upower widget
Last synced: 9 days ago
JSON representation
Battery status monitor
- Host: GitHub
- URL: https://github.com/shouya/batry
- Owner: shouya
- License: gpl-3.0
- Created: 2023-07-31T10:39:42.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2023-07-31T10:47:53.000Z (over 1 year ago)
- Last Synced: 2024-12-12T17:50:17.621Z (10 days ago)
- Topics: battery, battery-monitor, dbus, status-bar, upower, widget
- Language: Rust
- Homepage:
- Size: 37.1 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Battery status monitor
This is a small program that monitors battery status through
[UPower](https://upower.freedesktop.org/)'s DBus interface and outputs
status updates as JSON.I use it to serve battery information for the battery widget on my
status bar.### Reported information
- battery percentage
- wattage information
- status (charging, discharging, fully_charged, not_charging, unknown)
- time to full
- time to empty### Features
- Notification-based: The program is notified of changes, not polling for them.
+ Optionally, you can specify a force polling interval (`--min-poll-interval`) if you want.
- Alert: Run a custom alert command on low battery.
- Repeated alert: Run the alert command every X seconds if the battery remains low.
- Lightweight: The program is carefully crafted and uses negligible resources.### Usage
``` text
$ batry --help
Usage: batry [OPTIONS]Options:
-i, --min-poll-interval
Minimal polling interval in seconds. If not set, the monitor will only poll when the power source or battery status changes.
-t, --alert-threshold
Alert threshold in percent. If the battery percentage is below this threshold, the alert command will be executed [default: 10].
-c, --alert-command
Command to execute when the battery percentage is below the alert threshold. The command will be executed with `sh -c`.
-r, --alert-refire-interval
Refire interval in seconds. The alert command will only be executed once every `alert_refire_interval` seconds as long as the battery percentage is below the alert threshold.
-h, --help
Print help.
-V, --version
Print version.```
The output in each line is in JSON format.
### Build
You can run `cargo build --release` to build the program.