~ ✍️
RSS image

« Back to index

Releasing powernotd

Jun 12 2023

Powernotd is a small battery-level desktop notification daemon for Linux/Unix that I have written in Rust.

Release binaries: https://github.com/Laeri/powernotd/releases.

Github link: Powernotd on Github

Currently there is an arch user repository (aur) package available: Aur package link

If I get to it I will also probably create an rpm, deb and maybe a flatpack package.

As it is a rust project I also published it as a crate: Crate Link

It also includes bash and other shell completions (fish, zsh, elvish).

Powernotd Screenshot

I started this project after switching to Archlinux together with Hyprland as window manager as my new daily driver operating system. Because Arch and Hyprland are very minimal you have to configure a lot of things yourself. For example it doesn’t have any kind of menu bar, nor is there some service that notifies you when your laptop battery runs out. Because your laptop shutting off at some point is quite annoying I started building powernotd as a small battery-level notification daemon. It is written in Rust as I just started learning this programming language and decided that this would be a great small learning project.

The result is powernotd: Powernotd on Github

I have been using powernotd for quite some time and fit works well for my use case. The only thing missing might be to create some systemd service files that are installed and also create some additional packages.

Powernotd sends desktop notifications according to the ‘Desktop Notification Standard which the system will present to the user graphically usually in the form of a small toast depending on your operating system. Powernotd checks your battery-level and emits notifications in case they reach certain thresholds. It is only responsible for sending events and your system will need some kind of notification display daemon which displays and renders the notification on your system.

If you use a desktop environment such a notification display daemon will be usually included. If not for example mako or dunst are popular choices.

Powernotd can be configured with a configuration file. See the section.

The current battery-level is read from /sys/class/power_supply/BAT0/capacity which is a file written to by the operating system’s power management. This file is polled every minute and the battery-level is compared with the threshold values to see if a notification has to be sent.

Creating a command line application that also generates shell completion files was quite interesting and it will probably be worth its own post.

Who may use this

If you use a minimal linux distribution and you do not have a full desktop environment configured but you use only a window manager such as i3, awesome, bspwm, hyprland, sway, … A desktop environment usually has some kind of battery notification service integrated whereas a window manager usually doesn’t. When I switched to Arch using Hyprland I needed such a notification service and therefore created this project.


Release binaries: https://github.com/Laeri/powernotd/releases.

Using cargo

Crate Link cargo install powernotd

Aur package

Aur package link yay -Sy powernotd, paru -Sy powernotd