power-rules-daemon

Crates.iopower-rules-daemon
lib.rspower-rules-daemon
version1.0.0
created_at2025-08-03 20:39:46.319159+00
updated_at2025-08-04 12:22:28.198002+00
descriptionA daemon for defining power rules for the power-profiles-daemon.
homepage
repositoryhttps://github.com/zeioth/power-rules-daemon
max_upload_size
id1780090
size77,125
(Zeioth)

documentation

README

How to install

<your-package-manager-install-command> power-profiles-daemon
cargo install power-rules-daemon

Create the service ~/.config/systemd/user/power-rules-daemon.service

[Unit]
Description=Power Rules Daemon
After=graphical-session.target

[Service]
ExecStart=%h/.cargo/bin/power-rules-daemon
Restart=on-failure

[Install]
WantedBy=default.target

And enable both power-profiles-daemon and power-rules-daemon with:

systemctl --user daemon-reload
systemctl --user enable --now power-profiles-daemon.service
systemctl --user enable --now power-rules-daemon.service

Now you can add your rules to ~/.config/power-rules/config.toml

Rules example

Most users will use this daemon for gaming with rules like

[config]
default_profile = "balanced"  # Profile to use when no rules are triggered atm.
polling_interval = 5          # Amount of seconds before checking if a rule is triggered.
pause_on_manual_change = 180  # If the user manually changes the power profile (through the desktop environment gui, for example), the daemon is paused for n minutes.

# While a steam game is executed
[[rule]]
name = "steamapps/common"
profile = "performance"

# While launchers are executed
[[rule]]
name = "lutris"
profile = "performance"

[[rule]]
name = "heroic"
profile = "performance"

[[rule]]
name = "gamehub"
profile = "performance"

[[rule]]
name = "retroarch"
profile = "performance"

Rules are applied by order from above to below of the config file.

If no rules are currently triggered, default_profile will be the one used.

For package maintainers: How to distribute this program

Distributing this program in a linux distro is very easy! The installer should just:

  • Install the program with: cargo install power-rules-daemon
  • Copy the service (the user can enable it / start it himself).
  • Add the program power-profiles-daemon.

TODOS

  • Implement proper log files support.
  • Tests (once features are confirmed).
  • CI tests pipeline.
  • Better docstrings, so nice docs can be CI pipelined.
  • A man file is probably a good idea.
  • Let's consider a few options for notifications, in case the user want to have them (it makes easier to visually confirm what's going on).

Credits

This progaram was originally a proposal to replace the program game-performance on CachyOS. And now it can be used on any distro!

Commit count: 0

cargo fmt