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 imagesman 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.
| Input | Action |
|---|---|
Enter | Unlock. On an empty field, starts fingerprint or security key, except while Wrong password shows |
Backspace | Delete a character |
Esc, Ctrl+U | Clear the field |
Esc after 10 s of checking | Cancel the attempt |
| Click the eye | Show 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
| Option | Does |
|---|---|
-f, --daemonize | Return once the screen is locked |
--config <path> | Use another config file |
--no-config | Ignore the config file |
--set <key>=<value> | Set any config key |
--check | Report 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, --help | Show usage |
-V, --version | Show the version |
A bad or unknown flag is logged and ignored. It never stops the screen from locking.
| Exit code | Meaning |
|---|---|
0 | Unlocked |
1 | Anything 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 failedStates: idle, typing, revealed, checking, failed, info, error,
caps, layout, cancel, quiet.
Signals
| Signal | Does |
|---|---|
SIGUSR1 | Unlock |
SIGTERM, SIGINT | Exit. The session stays locked |
SIGHUP | Ignored, 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 sweetlockIf 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 sweetlockLevels: error, warn, info (default), debug.
Files
| Path | Purpose |
|---|---|
$XDG_CONFIG_HOME/sweetlock/config.toml | Config file (~/.config when unset) |
$XDG_CACHE_HOME/sweetlock/ | Background and avatar cache (~/.cache when unset) |
/etc/pam.d/sweetlock | PAM service (/usr/local/etc/pam.d/sweetlock on FreeBSD) |