Sweets

Installation

Install and start the sweetidle idle daemon

sweetidle is one binary. With no command it runs the daemon. With a command like status it talks to the running daemon. On FreeBSD, see FreeBSD.

Arch Linux

yay -S sweetidle-bin   # or sweetidle-git

NixOS

Add the flake and import the module:

{
  inputs = {
    nixpkgs.url = "nixpkgs/nixos-26.05";
    sweetidle = {
      url = "github:naurissteins/sweetidle";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };

  outputs = { nixpkgs, sweetidle, ... }: {
    nixosConfigurations.myhost = nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      modules = [
        ./configuration.nix
        sweetidle.nixosModules.default
      ];
    };
  };
}

Enable the service:

services.sweetidle = {
  enable = true;
  settings = {
    general.before_sleep_command = "veila lock --wait-ready";
    listener = [
      { timeout = 300; on_timeout = "veila lock --wait-ready"; }
      {
        timeout = 600;
        on_timeout = "sweets msg output-power '*' off";
        on_resume = "sweets msg output-power '*' on";
      }
    ];
  };
};
OptionDefaultDescription
enablefalseInstall sweetidle and start it with graphical-session.target
packagefrom the flakeThe sweetidle package
settings{}Config written to /etc/sweetidle/config.toml, checked at build time

Leave settings empty to use ~/.config/sweetidle/config.toml. After a rebuild, run systemctl --user reload sweetidle.service. A new version needs a restart.

Build from source

Needs a stable Rust toolchain.

git clone https://github.com/naurissteins/sweetidle.git
cd sweetidle
cargo build --release
sudo install -Dm755 target/release/sweetidle /usr/local/bin/sweetidle
sudo install -Dm644 systemd/sweetidle.service /usr/local/lib/systemd/user/sweetidle.service
sudo install -Dm644 man/sweetidle.1 /usr/local/share/man/man1/sweetidle.1
systemctl --user daemon-reload

Add a config

The config file is required.

mkdir -p ~/.config/sweetidle
curl -o ~/.config/sweetidle/config.toml \
  https://raw.githubusercontent.com/naurissteins/sweetidle/main/config/example.toml
sweetidle --check-config

The example uses Veila and sweets msg. Change the commands to match your setup.

Start the daemon

systemctl --user enable --now sweetidle.service
journalctl --user -u sweetidle.service -f

The service starts with graphical-session.target, which Sweets activates.

Don't also start sweetidle from your Sweets config. Only one daemon can run.

Other compositors

sweetidle also runs on Sway, Hyprland, niri, labwc, mangowc, and river. niri starts graphical-session.target. On the others, autostart it:

CompositorAutostart
Swayexec sweetidle
Hyprlandexec-once = sweetidle
mangowcexec_once=sweetidle
labwcsweetidle & in ~/.config/labwc/autostart

Display power commands:

CompositorOffOn
Swayswaymsg "output * power off"swaymsg "output * power on"
Hyprlandhyprctl dispatch dpms offhyprctl dispatch dpms on
niriniri msg action power-off-monitorsniri msg action power-on-monitors
labwc, mangowc, riverwlopm --off '*'wlopm --on '*'

On this page