Sweets

Session lock

Lock your screen and recover from a crashed locker

Sweets works with screen lockers like swaylock, Veila, and gtklock. Bind one to a key:

sweets.bind("MOD+Alt+L", "spawn", { "swaylock" })

While locked, nothing on your desktop is visible or captured. Only the locker can unlock it.

Turn monitors off while locked

An idle tool can turn all enabled monitors off and back on:

sweets msg output-power '*' off
sweets msg output-power '*' on

Turning them on keeps the screen locked. Your locker or idle tool controls when they wake. See IPC for power commands.

If the locker crashes

The screen stays locked and black. After a second, a notice appears.

To restart the locker automatically, set lock_restart:

sweets.general({ lock_restart = { "swaylock" } })

Sweets tries up to three times. Leave it unset if your locker restarts itself.

To restart it by hand, log in from another TTY or over SSH and run:

XDG_RUNTIME_DIR=/run/user/$(id -u) WAYLAND_DISPLAY=wayland-1 swaylock

Find the right wayland-N name in the session log:

grep "Wayland socket ready" ~/.local/state/sweets/sweets.log

For more about the log, see Troubleshooting.

On this page