Dansk

ahfail

A screen locker for Linux and macOS. Type the wrong password and Dennis Nedry shows up to tell you "ah ah ah, you didn't say the magic word".

Language
Rust
Licence
AGPL-3.0-only
Runs on
Linux (Wayland), Linux (X11), macOS

Get the password wrong and a looping animation of my own face photoshopped onto Dennis Nedry from Jurassic Park appears, while the “ah ah ah, you didn’t say the magic word” clip plays. The volume goes all the way up, so whoever tried to sneak into your machine gets the full experience (--no-max-volume if you’d rather be discreet). Under the joke it’s a real screen locker.

ahfail          # lock the screen
ahfail test     # see the effect without locking
ahfail doctor   # what is this machine missing?

It’s one program on Linux, and it works out by itself whether you run Wayland or X11. On Wayland it locks through ext-session-lock-v1, so it works in sway, Hyprland, niri, river, labwc and KDE Plasma 6. GNOME doesn’t let other programs lock the screen, so it’s out there. On X11 it does what i3lock does: full-screen windows on every monitor and a grab on keyboard and pointer, and if it can’t get the grab it refuses to lock rather than show a lock screen your keystrokes go straight through.

The password is checked through its own PAM service, /etc/pam.d/ahfail, which the package installs. It doesn’t touch any other package’s PAM configuration, the same way swaylock and gtklock don’t. It includes login, so the system’s pam_faillock policy applies, and on Arch that means three wrong passwords within fifteen minutes lock the account for ten. Worth knowing before you show it off on a Friday afternoon.

A screen locker sits right in the authentication path, so a bug in it could weaken the lock in the worst case. There are no guarantees, and you install it at your own risk. The package says so too.

Install

On Arch Linux, from source or prebuilt:

yay -S ahfail
yay -S ahfail-bin

Run ahfail doctor afterwards. It tells you whether the session type is supported, whether the PAM file is in place, whether GStreamer can play the clip and whether the volume can be controlled, with the exact fix if something is missing.

To lock automatically, point your idle daemon at it:

swayidle -w timeout 300 'ahfail' before-sleep 'ahfail'   # Wayland
xss-lock -- ahfail                                       # X11

macOS

On a Mac the system lock screen does the locking, and the effect comes from a PAM hook installed through Homebrew:

brew tap asger-weirsoee/tap
brew install ahfail

Homebrew then prints the one line to add to /etc/pam.d/screensaverui. That’s the only manual step.