Installation
Build sweetlock, set up PAM, and bind it to a key
On FreeBSD, see FreeBSD.
Arch Linux
yay -S sweetlock-binUse sweetlock-git for the development branch.
NixOS
The repository is a flake. Add it as an input and use its overlay:
inputs.sweetlock = {
url = "github:sweetwm/sweetlock";
inputs.nixpkgs.follows = "nixpkgs";
};nixpkgs.overlays = [ inputs.sweetlock.overlays.default ];
environment.systemPackages = [ pkgs.sweetlock ];
security.pam.services.sweetlock = {};nix run github:sweetwm/sweetlock -- --version tries it without
installing. The flake has no NixOS module, so the PAM line is yours to add.
PAM
sweetlock authenticates with the sweetlock PAM service. On Linux the installed
file includes your system's login stack:
auth include loginOn NixOS, add the service to your system config instead:
security.pam.services.sweetlock = {};Check it before your first real lock:
sweetlock --checkBuild from source
Requirements:
- Meson, Ninja, and a C17 compiler
wayland-client,wayland-protocols1.32+,wayland-scannerxkbcommon,pam,cairo1.18+,pangolibjpeg-turbo. Plain IJG libjpeg is refusedscdoc, optional, for thesweetlock(1)andsweetlock(5)man pages
git clone https://github.com/sweetwm/sweetlock.git
cd sweetlock
meson setup build -Dbuildtype=release --prefix=/usr
meson compile -C build
sudo meson install -C buildOn Linux, use --prefix=/usr. It installs the PAM service to
/etc/pam.d/sweetlock. The default /usr/local prefix puts it where Linux-PAM
never looks. On FreeBSD, keep the default (see FreeBSD).
Without the sweetlock service, PAM refuses every password. The screen locks
and only SIGUSR1 unlocks it.
Fingerprint and security keys
sweetlock runs whatever your PAM stack has and shows each module's message under the field.
- Fingerprint (
pam_fprintd): pressEnteron the empty field, then touch the reader. - Security key (
pam_u2f): pressEnter, then touch the key. - Lockout (
pam_faillock): the lockout message shows under the field.
With pam_fprintd ahead of pam_unix, a typed password waits until the reader
gives up (up to 30 s). To skip that, give /etc/pam.d/sweetlock a stack without
pam_fprintd.
Bind keys
Add a binding to your Sweets config:
sweets.bind("MOD+Shift+L", "spawn", { "sweetlock" })Restart the locker if it crashes:
sweets.general({ lock_restart = { "sweetlock" } })See Session lock.
Lock on idle
Sweets has no idle timer. Use sweetidle to run the locker:
[general]
lock_command = "sweetlock -f"
before_sleep_command = "sweetlock -f"
after_resume_command = "sweets msg output-power '*' on"
[[listener]]
timeout = 300
on_timeout = "sweetlock -f"-f returns once the screen is locked, so the system sleeps already locked.
If the session is already locked, a second sweetlock exits and the lock stays.