Sweets

Configuration

The sweetidle config file

sweetidle reads ~/.config/sweetidle/config.toml, or another file with --config <path>. The file is required.

[general]
lock_command = "veila lock --wait-ready"
before_sleep_command = "veila lock --wait-ready"
after_resume_command = "sweets msg output-power '*' on"

[[listener]]
timeout = 300
on_timeout = "veila lock --wait-ready"
ignore_inhibit = true

[[listener]]
timeout = 600
on_timeout = "sweets msg output-power '*' off"
on_resume = "sweets msg output-power '*' on"

Check it, then apply it with sweetidle reload:

sweetidle --check-config

Unknown keys, bad timeouts, and empty commands are errors.

Examples

Lock after 5 minutes

[[listener]]
timeout = 300
on_timeout = "veila lock --wait-ready"
ignore_inhibit = true # lock even while a video plays

Turn off displays after 10 minutes

[[listener]]
timeout = 600
on_timeout = "sweets msg output-power '*' off"
on_resume = "sweets msg output-power '*' on"

Lock before suspend

[general]
before_sleep_command = "veila lock --wait-ready"
after_resume_command = "sweets msg output-power '*' on"
wait_before_sleep = true

Use a locker that returns only after the screen is locked. On FreeBSD this needs the rc hook.

Handle loginctl lock-session

Linux only.

[general]
lock_command = "veila lock --wait-ready"

[general]

All keys are optional.

KeyDefaultDescription
lock_commandunsetRun on a logind lock request. Linux only
unlock_commandunsetRun on a logind unlock request. Linux only
before_sleep_commandunsetRun before suspend
after_resume_commandunsetRun after resume
wait_before_sleeptrueHold suspend until the before-sleep command exits (logind max delay on Linux, 4 s on FreeBSD)
ignore_dbus_inhibitfalseIgnore ScreenSaver D-Bus inhibitors
ignore_systemd_inhibitfalseIgnore systemd-logind inhibitors. No effect on FreeBSD

Only set unlock_command if your locker has a safe unlock command.

[[listener]]

One table per timeout.

KeyDefaultDescription
timeoutrequiredIdle seconds, 1 to 4294967
on_timeoutunsetRun when the timeout expires
on_resumeunsetRun on activity, only if on_timeout fired
ignore_inhibitfalseRun despite all inhibitors. Needs ext_idle_notifier_v1 v2

[idle_hint]

Linux only.

KeyDefaultDescription
timeoutrequiredIdle seconds before the session is reported idle to logind

Commands

Commands run through sh -c with sweetidle's PATH. stdout is discarded, stderr goes to sweetidle's log. Stopping sweetidle leaves running commands alive.

Inhibitors

SourceExampleOpt out
CompositorA Sweets idle_inhibit ruleignore_inhibit per listener
D-BusA browser playing videoignore_dbus_inhibit = true
systemd (Linux)systemd-inhibit --what=idleignore_systemd_inhibit = true

sweetidle status lists D-Bus and systemd inhibitors. Compositor inhibitors are not visible to clients.

On this page