Skip to content
Snippets Groups Projects

SystemCshee - batteryd

The newest, coolest, fastest and smallest useless daemon for your system!

My name is Csaba Zámolyi, and my nickname is "Cshee" (pronunciation: /'tʃeː/), hence the main project name: SystemCshee (/'sɪstəmtʃeː/). This daemon is part of the SystemCshee project, but is compilable and runnable completely separately, it's not tied to other parts of SystemCshee. (Quite possibly beause no other parts exist. Yet.)

What is this?

This daemon does nothing more and nothing less than monitoring your battery level and taking action(s) at set treshold(s) The tresholds and the actions to take are both configurable in /etc/systemcshee/batteryd.conf

Why?

Why not? It was a long and rough day and around 2AM, after 5-6 beers, it seemed to be a good idea to write a daemon for a task I wanted, but mostly for my personal amusement. This is generally intended as a joke, although for me, it serves real purpose. I didn't want to use any 3rd party service for monitoring my battery level(s), because I know exactly what I want and how I want to do it and what configuration options I wish. Obviously this could have been done with a shell script in a cronjob, but it's not that fun. The task seemed easy enough to do for myself. This wants to be a small and easily usable software, and it would be really fun if other people used it or did something with it 🙂

Also, this is for learning in a fun, but somewhat productive way.

Features

For system batteries you can configure three different tresholds (half, low, critical) and for each a corresponding action to take in the config file. For any treshold you can choose ignore it, get a notification, sleep or shut down the system.

You can also monitor your wireless keyboard and/or mouse. At this time, only one device is supported, but later I want to add support for monitoring multiple wireless or other battery powered devices as well. batteryd can notify you if your keyboard or mouse is going to run out of power soon. You most probably want to get a notification, but nothing stops you from configuring sleep or shutdown for it as well 🙂

Configuration

batteryd can be configured with a batteryd.conf file located at /etc/systemcshee/batteryd.conf

An example can be found in batteryd.conf.example

Building

You can build this project with CMake or technically anything else you can make it work with.

If you want to use syslog instead of a logfile in /var/log/systemcshee/batteryd.log then add -DUSE_SYSLOG=1 to cmake parameters or define USE_SYSLOG any other way.

License

This project is under the GNU General Public License v3.0