← 返回命令列表

Linux command

swaylock 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Lock screen

swaylock

With solid color

swaylock -c [1a1a2e]

With image

swaylock -i [wallpaper.jpg]

Per-output images

swaylock -i [HDMI-A-1:wallpaper.jpg]

Blur effect

swaylock --effect-blur [7x5]

Show failed attempts

swaylock -f --show-failed-attempts

Daemonize

swaylock -f

说明

swaylock is a screen locking utility for Sway and other Wayland compositors, providing secure session locking with PAM-based authentication. It renders a lock screen over all outputs and requires the user's password to unlock. The lock screen background can be customized with solid colors or images, with per-output image support for multi-monitor setups. An indicator ring shows the current state: idle, typing, password verification, and incorrect password. The swaylock-effects fork adds additional visual effects like blur. The daemonize flag causes swaylock to fork to the background after the lock screen is displayed, which is essential when used with swayidle's before-sleep event to ensure the screen is locked before the system suspends.

参数

-c, --color _COLOR_
Background color.
-i, --image _IMAGE_
Background image.
-f, --daemonize
Run as daemon.
-s, --scaling _MODE_
Image scaling.
--effect-blur _PARAMS_
Blur effect.
--show-failed-attempts
Show failures.
--indicator-radius _N_
Indicator size.

FAQ

What is the swaylock command used for?

swaylock is a screen locking utility for Sway and other Wayland compositors, providing secure session locking with PAM-based authentication. It renders a lock screen over all outputs and requires the user's password to unlock. The lock screen background can be customized with solid colors or images, with per-output image support for multi-monitor setups. An indicator ring shows the current state: idle, typing, password verification, and incorrect password. The swaylock-effects fork adds additional visual effects like blur. The daemonize flag causes swaylock to fork to the background after the lock screen is displayed, which is essential when used with swayidle's before-sleep event to ensure the screen is locked before the system suspends.

How do I run a basic swaylock example?

Run `swaylock` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -c, --color _COLOR_ do in swaylock?

Background color.