Skip to content

Latest commit

 

History

History
31 lines (22 loc) · 835 Bytes

README.md

File metadata and controls

31 lines (22 loc) · 835 Bytes

batnotifyd

Lightweight daemon for low battery notifications on GNU/Linux. Requires libudev and libnotify. Written in Zig.

Build & Run

nix develop # if using Nix
zig build -Drelease-safe
./zig-out/bin/batnotifyd

Recommended usage

batnotifyd can run a command if the battery gets "dangerously low" (default is 2%, configure with --danger_threshold). It's highly recommended to set it to suspend, or hibernate if your system supports it:

./zig-out/bin/batnotifyd --danger_hook 'systemctl suspend'

Install

A systemd --user unit file is included for convenience.

zig build
sudo install -m 755 ./zig-out/bin/batnotifyd /usr/local/bin/
install -Dm 644 batnotifyd.service -t ~/.config/systemd/user/
systemctl --user daemon-reload
systemctl --user enable --now batnotifyd