https://github.com/0snap/batalert
Send D-Bus notifications when the (Linux) host's battery runs low. Written in Rust.
https://github.com/0snap/batalert
battery-monitor desktop-notifications linux rust
Last synced: 27 days ago
JSON representation
Send D-Bus notifications when the (Linux) host's battery runs low. Written in Rust.
- Host: GitHub
- URL: https://github.com/0snap/batalert
- Owner: 0snap
- License: mit
- Created: 2020-12-26T10:50:42.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-04-21T14:29:45.000Z (about 4 years ago)
- Last Synced: 2025-02-06T12:15:52.496Z (3 months ago)
- Topics: battery-monitor, desktop-notifications, linux, rust
- Language: Rust
- Homepage:
- Size: 13.7 KB
- Stars: 4
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
batalert
Send [D-Bus](https://www.freedesktop.org/wiki/Software/dbus/) notifications when the (Linux) host's battery runs low.
[![License][license-badge]][license-url]
## Prerequisites
- Install `libnotify`
- Install a Notification Server to render desktop notifications
- Use [mako](https://github.com/emersion/mako) on Wayland/Sway setups## Usage
You can run `batalert` with default setting to send the first notification when the battery falls below 15% and repeat the notification every 3%. Notifications timeout after 15 seconds. `batalert` resets when you plug-in your charger.
### Customization
- Check the help text:
```
batalert -h
```
- Show a notification when the battery falls below 20%, repeat notification every 4% on 16%, 12%, 8% ... :
```
batalert --alert 20 --notification-step 4
```
- Timeout notifications after a minute:
```
batalert --timeout 60
```
- Use a custom icon:
```
batalert --icon /usr/share/icons/.png
```
- Monitor a particular battery, e.g., `BAT2`:
```
batalert --uevent /sys/class/power_supply/BAT2/uevent
```
- Monitor multiple batteries (repeat the `--uevent` option):
```
batalert --uevent /sys/class/power_supply/BAT0/uevent --uevent /path/to/bat1 -u /path/to/bat2
```## Building
Build the app via `Cargo`:
```
cargo build --release
```[license-badge]: https://img.shields.io/badge/license-MIT-blue.svg
[license-url]: https://github.com/0ortmann/batalert/blob/master/LICENSE