A small, secure Wayland screenlocker https://isaacfreund.com/software/waylock
Isaac Freund 322f81c231
All checks were successful
builds.sr.ht/alpine Job completed
builds.sr.ht/archlinux Job completed
builds.sr.ht/freebsd Job completed
build: bump version to 1.5.0-dev
2025-03-07 11:22:46 +01:00
.builds build: update to zig 0.14.0 2025-03-07 11:15:30 +01:00
doc cli: add -input-alt-color 2024-10-03 12:41:41 +02:00
pam.d pam: Use a proper PAM service name 2022-04-28 14:42:17 +02:00
src build: update to zig 0.14.0 2025-03-07 11:15:30 +01:00
.gitignore build: update to Zig 0.13.0 2024-06-07 13:30:21 +02:00
build.zig build: update to zig 0.14.0 2025-03-07 11:15:30 +01:00
build.zig.zon build: bump version to 1.5.0-dev 2025-03-07 11:22:46 +01:00
LICENSE Implement barebones wayland side of things 2022-04-28 14:31:56 +02:00
PACKAGING.md build: switch to the Zig package manager 2024-05-19 11:37:08 +02:00
README.md build: update to zig 0.14.0 2025-03-07 11:15:30 +01:00

waylock

Waylock is a small screenlocker for Wayland compositors implementing ext-session-lock-v1. The ext-session-lock-v1 protocol is significantly more robust than previous client-side Wayland screen locking approaches. Importantly, the screenlocker crashing does not cause the session to be unlocked.

Install from your package manager

The main repository is on codeberg, which is where the issue tracker may be found and where contributions are accepted.

Read-only mirrors exist on sourcehut and github.

Building

Image for: Building

Note: If you are packaging waylock for distribution, see PACKAGING.md.

To compile waylock first ensure that you have the following dependencies installed:

  • zig 0.14
  • wayland
  • wayland-protocols
  • xkbcommon
  • pam
  • pkg-config
  • scdoc (optional, but required for man page generation)

Then run, for example:

zig build -Doptimize=ReleaseSafe --prefix /usr install

Note that PAM will only use configuration files in the system directory, likely /etc/pam.d by default. Therefore care must be taken if installing to a prefix other than /usr to ensure the configuration file pam.d/waylock is found by PAM.

Usage

Image for: Usage

See the waylock(1) man page or the output of waylock -h for an overview of the command line options.

Run the waylock executable to lock the session. All monitors will be blanked with the -init-color. Typing causes the color to change to the -input-color. Esc or Ctrl-U clears all current input, while backspace deletes the last UTF-8 codepoint.

To unlock the session, type your password and press Enter. If the password is correct, waylock will unlock the session and exit. Otherwise, the color will change to the -fail-color and you may try again.

In order to automatically run waylock after a certain amount of time with no input or before sleep, the swayidle utility or a similar program may be used. See the swayidle(1) man page for details.

Licensing

Image for: Licensing

Waylock is released under the ISC License.