#notifications #battery #linux #cli-command #command #cli

app battered

Regularly polls battery levels and sends notifications on crossing certain thresholds

1 unstable release

new 0.5.0 Feb 18, 2025

#1023 in Command line utilities

MIT license

27KB
168 lines

battered

crates.io

battered Icon

Regularly polls battery levels and sends notifications on crossing certain thresholds.

The idea is to have one notification to warn about the battery discharging and another, persistent, notification when action has to be taken. Both thresholds and the poll interval can be configured.


Table of Contents

Usage

Simply run battered:

battered

Installation

battered is available on crates.io and can be installed from there:

cargo install battered

Configuration

battered looks for a configuration file in the following places:

  1. $XDG_CONFIG_HOME/battered/config.toml
  2. $HOME/.config/battered/config.toml
  3. /.config/battered/config.toml if $HOME is not set

Example config:

[general]
interval = 60              # in seconds
threshold_low = 0.8        # percentage as decimal
threshold_critical = 0.25  # percentage as decimal
action_low = "tuned-adm profile laptop-battery-powersave"
action_critical = "systemctl suspend"

Logging

Logging is configured via the RUST_LOG env variable. The provided systemd unit example sets the log level to WARN per default.

Dependencies

~3–29MB
~413K SLoC