You are not logged in.

#1 2018-01-14 05:36:04

Defender110
Member
Registered: 2017-12-28
Posts: 5

systemd triggers screensaver *after* laptop is un-suspended

I'm trying to get systemd to kick on my screen lock before the laptop is suspended.  I'm using a unit that uses a

After=sleep.target

directive to kick off the locker:


/etc/systemd/system/suspend@.service
[Unit]
Description=User suspend actions
After=sleep.target

[Service]
User=%I
Environment=DISPLAY=:0
ExecStart=/usr/bin/xlock -mode mountain

[Install]
WantedBy=sleep.target

It partially works.  When you close the laptop, it will go to sleep and the screen will be locked but the screen doesn't actually lock until you open the laptop back up.  This results in the unlocked screen being visible for a brief moment.

Using xss-lock in place of systemd produces the same faulty result.

This is a ThinkPad X1 gen 5 but I have the same issue on my older ThinkPads.

Last edited by Defender110 (2018-01-14 05:38:08)

Offline

#2 2018-01-14 06:36:59

ooo
Member
Registered: 2013-04-10
Posts: 1,326

Re: systemd triggers screensaver *after* laptop is un-suspended

Why are you using After= if you wan't to start the screen lock before sleep?
Replacing it with Before= should work as you intended.

https://wiki.archlinux.org/index.php/Po … leep_hooks

Online

Board footer

Powered by FluxBB