Sweets

Usage

Lock, unlock, and recover

sweetlock           # lock until you unlock
sweetlock -f        # return once the screen is locked
sweetlock --check   # check the config, PAM, and images

man sweetlock and man 5 sweetlock have the same reference offline.

Lock screen

Keys from every keyboard type into one password field. Your keyboard layout, dead keys, and Compose work as usual.

InputAction
EnterUnlock. On an empty field, starts fingerprint or security key, except while Wrong password shows
BackspaceDelete a character
Esc, Ctrl+UClear the field
Esc after 10 s of checkingCancel the attempt
Click the eyeShow or hide the typed text

A wrong password shows Wrong password for 1.5 s. PAM messages and Caps Lock is on show under the field.

Reference

OptionDoes
-f, --daemonizeReturn once the screen is locked
--config <path>Use another config file
--no-configIgnore the config file
--set <key>=<value>Set any config key
--checkReport config, PAM, and image problems (and the layout list with input.layout = "corner"), then exit
--preview <file>Draw the lock screen to a PNG instead of locking
--size <W>x<H>Output size for --preview, each side up to 8192. Default 1920x1080
--scale <s>Output scale for --preview, above 0 and up to 8. Default 1
--preview-state <state>Field state for --preview, like typing or failed
-h, --helpShow usage
-V, --versionShow the version

A bad or unknown flag is logged and ignored. It never stops the screen from locking.

Exit codeMeaning
0Unlocked
1Anything else. The session may still be locked

With -f, 0 means the screen is locked. 1 means it failed, for example because the session is already locked.

Preview

Screenshots are blocked while locked. Use --preview to see your config:

sweetlock --preview lock.png --size 2560x1440 --scale 1.5
sweetlock --preview failed.png --preview-state failed

States: idle, typing, revealed, checking, failed, info, error, caps, layout, cancel, quiet.

Signals

SignalDoes
SIGUSR1Unlock
SIGTERM, SIGINTExit. The session stays locked
SIGHUPIgnored, so closing the terminal keeps the lock

Recovery

If you can't unlock, log in from another TTY or over SSH and send SIGUSR1:

pkill -USR1 -xo sweetlock

If sweetlock crashed, Sweets keeps the screen black. Start a new locker or use lock_restart.

Logs

sweetlock logs to stderr. Set the level with SWEETLOCK_LOG:

SWEETLOCK_LOG=debug sweetlock

Levels: error, warn, info (default), debug.

Files

PathPurpose
$XDG_CONFIG_HOME/sweetlock/config.tomlConfig file (~/.config when unset)
$XDG_CACHE_HOME/sweetlock/Background and avatar cache (~/.cache when unset)
/etc/pam.d/sweetlockPAM service (/usr/local/etc/pam.d/sweetlock on FreeBSD)

On this page