Linux - screen lockers
Table of Contents
Install slock
paru -S slock
Create a systemd service and edit the file
We need to create this file: /etc/systemd/system/wakelock@.service
Why keep the name of the file generic? So that you can switch the tool used for locking but keep the configuration consistent.
Edit the file:
sudo emacs /etc/systemd/system/wakelock@.service
Contents of the file
[Unit]
Description=Lock the screen on resume from suspend
Before=sleep.target
Before=sleep.target suspend.target
[Service]
User=%i
Type=simple
Environment=DISPLAY=:0
ExecStartPre=/usr/bin/xset dpms force suspend
ExecStart=/usr/bin/slock
[Install]
WantedBy=sleep.target suspend.target
Enable/Disable the service systemd unit
sudo systemctl enable wakelock@explorer436 --now