Skip to content
/ bato Public

Small program to send battery notifications

Notifications You must be signed in to change notification settings

doums/bato

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bato bato

bato

Small program to send battery notifications.

bato

Features

Configuration in YAML.

Notification events:

  • level full
  • level low
  • level critical
  • charging
  • discharging

Prerequisite

  • a notification server, like Dunst
  • libnotify

Install

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 &

Call this script from your window manager, autostart programs.

License

Mozilla Public License 2.0