LinuxCommandLibrary

i3lock

Lock the screen

TLDR

Lock the screen showing a white background

$ i3lock
copy

Lock the screen with a simple color background (rrggbb format)
$ i3lock [[-c|--color]] [0000ff]
copy

Lock the screen to a PNG background
$ i3lock [[-i|--image]] [path/to/file.png]
copy

Lock the screen and disable the unlock indicator (removes feedback on keypress)
$ i3lock [[-u|--no-unlock-indicator]]
copy

Lock the screen and don't hide the mouse pointer
$ i3lock [[-p|--pointer]] [default]
copy

Lock the screen to a PNG background tiled over all monitors
$ i3lock [[-i|--image]] [path/to/file.png] [[-t|--tiling]]
copy

Lock the screen and show the number of failed login attempts
$ i3lock [[-f|--show-failed-attempts]]
copy

SYNOPSIS

i3lock [-V] [-h] [-i image] [-c color] [-t] [-u] [-n] [-e] [-f] [-p pointer] [-s]

PARAMETERS

-V, --version
    Display version information and exit.

-h, --help
    Show usage help and available options.

-i, --image=file
    Display specified PNG or XPM image as background instead of default.

-c, --color=COLOR
    Set background to hexadecimal color (#rrggbb, default black).

-t
    Enable PAM service to track authentication failures.

-u
    Disable the unlock indicator ring.

-n, --nofork
    Do not fork into daemon mode (run in foreground).

-e
    Ignore empty password; use PAM password database.

-f
    Force display of analog clock over image.

-p, --pointer=pointer
    Set custom mouse pointer image (default: none).

-s
    Use screen geometry instead of root window.

DESCRIPTION

i3lock is a minimalistic screen locker utility for Linux systems running X11, originally developed for the i3 window manager but compatible with any X11-based session. Upon invocation, it immediately locks the display by overlaying a full-screen image, solid color background, or blurred/grayscale version of the current desktop, requiring the user's PAM-authenticated password to unlock.

It features a distinctive circular unlock indicator that provides visual feedback during password entry—a ring that fills clockwise with each character typed, turning green on correct input or red on failure. The locker supports customization via command-line options for background images (PNG or XPM), colors in hexadecimal format (#RRGGBB), pointer styles, and behaviors like ignoring empty passwords or disabling daemonization.

i3lock is designed for efficiency, forking into the background by default to minimize resource usage. It integrates seamlessly with tools like xss-lock for automatic locking on idle or suspend events. Multi-monitor support uses the root window geometry, and it handles DPMS (screen blanking) appropriately. While basic, its simplicity ensures reliability; popular forks like i3lock-color extend it with gradients, effects, and per-key colors. Commonly used in tiling WM setups for secure, distraction-free locking without heavy dependencies.

CAVEATS

X11-only (no native Wayland support); may require xss-lock(1) for idle/suspend triggering. Multi-monitor setups can misalign without tweaks. Relies on PAM; test authentication separately. Forking may hide errors—use -n for debugging.

USAGE EXAMPLES

i3lock -c 000000
i3lock -i ~/lock.png -u
xss-lock -- i3lock -i screenshot.png (auto-lock on idle)

INVOCATION TIP

Run via ~/.xinitrc, i3 config (bindsym $mod+l exec i3lock), or systemd service for reliability.

HISTORY

Created in 2010 by Michael Stapelberg for i3 window manager (i3wm.org). First release coincided with i3's growth in tiling WM popularity. Actively maintained in i3's Git repo; version 2.13+ added multi-monitor and effect support. i3lock-color fork (2015+) popularized advanced visuals, influencing upstream.

SEE ALSO

xss-lock(1), slock(1), xlock(1), i3(1), pam(8)

Copied to clipboard