https://github.com/evan-goode/batnotifyd
Lightweight daemon for low battery notifications on GNU/Linux
https://github.com/evan-goode/batnotifyd
zig
Last synced: 5 months ago
JSON representation
Lightweight daemon for low battery notifications on GNU/Linux
- Host: GitHub
- URL: https://github.com/evan-goode/batnotifyd
- Owner: evan-goode
- License: gpl-3.0
- Created: 2021-06-07T00:42:28.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-07-30T18:22:17.000Z (almost 2 years ago)
- Last Synced: 2025-07-28T21:51:17.481Z (11 months ago)
- Topics: zig
- Language: Zig
- Homepage:
- Size: 40 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# batnotifyd
Lightweight daemon for low battery notifications on GNU/Linux. Requires libudev and libnotify. Written in [Zig](https://ziglang.org/).
## 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
```