serhii.net

In the middle of the desert you can say anything you want

08 Jun 2024

Arch linux xlock before suspend service

Old way with systemd

/etc/systemd/system/user-suspend@.service:

[Unit]
Description=Lock the screen
Before=sleep.target

[Service]
User=%I
Type=forking
Environment=DISPLAY=:0
ExecStart=/usr/bin/xlock -usefirst -echokeys -description -modelist swarm,starfish,mandelbrot,polyominoes,fadeplot,matrix,lisa,life3d,life1d,kumppa,grav,flow


[Install]
WantedBy=sleep.target 

To enable1: sudo systemctl enable user-suspend@myusername.service

Arch wiki (Session lock - ArchWiki) omits @myusername which leads to this error:

Failed to enable unit: Destination unit sleep.target is a non-template unit.

Also: xlock (xlockmore) is neat, here’s a list of modes: XlockMore modes

(Also: XScreenSaver versus XLock)

Offtopic but cool: Cool, but obscure X11 tools

New way with xss-lock

Added this to qtile autostart:

xss-lock -- xlock -usefirst -echokeys -modelist qix,lisa & 

Also

Auto-lock after 300 seconds:

xset s on xset s 300

Nel mezzo del deserto posso dire tutto quello che voglio.