Contents

Getting Started Slock

Introduction

slock

Simple X display locker. This is the simplest X screen locker we are aware of.

1
2
git clone https://git.suckless.org/slock
cd slock

Before, your sudo make install You need

1
vim config.def.h

change to

1
2
3
/* user and group to drop privileges to */
static const char *user  = "yanboyang713";
static const char *group = "yanboyang713";

slock: getgrnam nogroup: group entry not found

Test, it is working.

1
2
[yanboyang713@manjaro] ➜ system whereis slock
slock: /usr/local/bin/slock

/etc/systemd/system/slock@.service

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
[Unit]
Description=Lock X session using slock for user %i
Before=sleep.target

[Service]
User=%i
Environment=DISPLAY=:0
ExecStartPre=/usr/bin/xset dpms force suspend
ExecStart=/usr/bin/slock

[Install]
WantedBy=sleep.target

systemctl daemon-reload

sudo systemctl enable slock@yanboyang713.service

Reference List

  1. https://github.com/bakkeby/slock-flexipatch