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-gitNixOS
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";
}
];
};
};| Option | Default | Description |
|---|---|---|
enable | false | Install sweetidle and start it with graphical-session.target |
package | from the flake | The 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-reloadAdd 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-configThe 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 -fThe 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:
| Compositor | Autostart |
|---|---|
| Sway | exec sweetidle |
| Hyprland | exec-once = sweetidle |
| mangowc | exec_once=sweetidle |
| labwc | sweetidle & in ~/.config/labwc/autostart |
Display power commands:
| Compositor | Off | On |
|---|---|---|
| Sway | swaymsg "output * power off" | swaymsg "output * power on" |
| Hyprland | hyprctl dispatch dpms off | hyprctl dispatch dpms on |
| niri | niri msg action power-off-monitors | niri msg action power-on-monitors |
| labwc, mangowc, river | wlopm --off '*' | wlopm --on '*' |