ArchWiki / Slock
ArchWiki / Slock
de:Slock ja:Slock zh-hans:Slock
Slock, or the "Simple X display locker", is a display locker for X that aims to be minimal, fast, and lightweight.https://tools.suckless.org/slock/.
Installation
Configuration
Configuration is done by editing the config.h header file and then recompiling the package. After configuration you should create a package.
Usage
Simply run slock to lock the screen. You can also provide an argument to be run after the screen has been locked:
$ slock cmd [arg ...]To unlock the screen, just type your password.
Tips and tricks
Lock on suspend
Create the following service which locks the screen.
[Unit]
Description=Lock X session using slock for user %i
Before=sleep.target
[Service]
User=%i
Environment=DISPLAY=:0
ExecStart=/usr/bin/slock
[Install]
WantedBy=sleep.target/etc/systemd/system/slock@.serviceEnable the slock@user.service systemd unit for it to take effect for the username user.
Block VT switching and prevent killing X
slock recommends blocking VT switching so that the screen lock cannot be bypassed. For the same reason, slock recommends preventing users from killing the X server. See Xorg#Block TTY access and Xorg#Prevent a user from killing X.