$linuxjunkies
>

swaylock(1)

Screen locker for Wayland compositors that turns the screen off after a timeout.

UbuntuDebianFedoraArch

Synopsis

swaylock [OPTION]..."

Description

swaylock is a screen locker for Wayland compositors. It displays a locked screen and prevents further interaction with the desktop until the correct password is entered. The screen can be configured to turn off after a timeout, and supports multiple displays.

swaylock is the recommended lock screen for Sway and other Wayland-based window managers. It reads the user's password from the login database and compares it against the entered password.

Common options

FlagWhat it does
-c, --colorSet the color displayed for the background when no image is set (hex value, e.g., #000000)
-i, --imageDisplay an image on the lockscreen (path to image file, use output names like HDMI-1 for per-display images)
-s, --scalingImage scaling mode: stretch, fill, fit, center (default: fill)
-t, --tilingTile the image instead of scaling it
-f, --fontSet the font used for text (e.g., 'monospace' or 'DejaVu Sans 12')
-S, --screenshotScreenshot the current screen and use it as the background image
-l, --line-uses-ringDisplay the line and ring around the password indicator
-e, --fadeoutFade to black after the given number of milliseconds (requires dmpower support)
-k, --key-bindsShow key bindings and exit
-h, --helpShow help message and exit

Examples

Lock the screen with a black background (default)

swaylock

Lock the screen with a dark gray background color

swaylock -c 1a1a1a

Lock the screen with a custom background image

swaylock -i ~/Pictures/lockscreen.png

Lock the screen using a screenshot of the current desktop as the background

swaylock -S -c 000000

Use different images for different displays

swaylock -i HDMI-1:~/wallpaper.png -i eDP-1:~/mobile.png

Lock with an image fitted to the screen and dark gray fallback color

swaylock -i ~/bg.png -s fit -c 333333

Related commands