/swaynag-battery

Shows a message when your battery is discharging

Primary LanguageGoMIT LicenseMIT

swaynag-battery

Release Software License

Shows a message on top of all displays (using swaynag) when battery is discharging and bellow an appointed threshold. Also, closes the message when a power supply is plugged in.

Installing

Download the appropriate latest version binary from releases or clone this repo, run make build and copy bin/swaynag-battery to somewhere in your PATH.

In order to automatically run swaynag-battery when you execute Sway, you can configure Sway to start using systemd and add a new user service file in ~/.config/systemd/user/swaynag-battery.service with

[Unit]
Description=Low battery notification
PartOf=graphical-session.target

[Service]
Type=simple
ExecStart=/absolute/path/to/swaynag-battery

[Install]
WantedBy=sway-session.target

and then

systemctl --user enable swaynag-battery.service
systemctl --user start swaynag-battery.service

API

Shows a message (using swaynag) when battery percentage is less then specified
value.

Usage:
  swaynag-battery [options]
  swaynag-battery -h | --help
  swaynag-battery --version

Options:
  --displays <display-list>  Comma separated list of displays to show the
                             alert - the default is to show in all displays.
  --threshold <int>          Percentual threshold to show notification.
                             [default: 15]
  --interval <duration>      Check battery at every interval. [default: 5m]
  --uevent <path>            Uevent path for reading battery stats.
                             [default: /sys/class/power_supply/BAT0/uevent]
  -h --help                  Show this screen.
  --version                  Show version.

Release Signatures

Releases are signed with B7704FFB48AC73A1 and published on GitHub.

Acknowledgments

A special thanks to Egor Kovetskiy who created i3-battery-nagbar, the program that inspired me to create this one.