bato
Small program to send battery notifications. Coded in Rust (and C).
features
Configuration in YAML.
Notification events:
- level full
- level low
- level critical
- charging
- discharging
prerequisite
- a notification server, like Dunst
- libnotify
install
Rust is a language that compiles to native code and by default statically links all dependencies.
Simply download the latest release of the compiled binary and use it! (do not forget to make it executable chmod 755 bato
)
Arch Linux AUR package
bato is present as a package in the Arch User Repository.
configuration
The binary looks for the config file bato.yaml
located in $XDG_CONFIG_HOME/bato/
(default to $HOME/.config/bato/
).
If the config file is not found, bato prints an error and exits.
All options are detailed here.
Example:
tick_rate: 1
critical_level: 5
low_level: 30
critical:
summary: Critical battery level!
body: Plug the power cable asap!
icon: battery-caution
low:
summary: Battery low
icon: battery-040
full:
summary: Battery full
icon: battery-full
urgency: Low
charging:
summary: Battery
body: Charging
icon: battery-good-charging
discharging:
summary: Battery
body: Discharging
icon: battery-good
usage
Run bato as a daemon. For example launch it from a script
#!/usr/bin/bash
mapfile -t pids <<< "$(pgrep -x bato)"
if [ "${#pids[@]}" -gt 0 ]; then
for pid in "${pids[@]}"; do
if [ -n "$pid" ]; then
kill "$pid"
fi
done
fi
bato &
and call this script from your windows manager, autostart programs.
license
Mozilla Public License 2.0