Closed orschiro closed 10 years ago
Yes, I'm using sxlock.service for that. I should probably move it into the sxlock package...
Thanks! Please move itindeed into the package. Would be much appreciated!
Done, closing.
Can you also add hibernate.target and hybrid-sleep.target next to the suspend.target?
Actually, sxlock.service
uses sleep.target
, which is pulled in by all suspend.target
, hibernate.target
and hybrid-sleep.target
.
In that case I will have to investigate why sxlock is not triggered on my machine on resume from hibernation.
I will let you know!
It should be triggered before hibernating.
The service enters a failed state:
~ systemctl status sxlock
sxlock.service - Lock X session using sxlock
Loaded: loaded (/usr/lib/systemd/system/sxlock.service; enabled)
Active: failed (Result: exit-code) since Di 2014-03-18 22:54:13 CET; 2min 5s ago
Process: 18078 ExecStart=/usr/bin/sxlock (code=exited, status=217/USER)
Main PID: 18078 (code=exited, status=217/USER)
Mär 18 22:54:13 thinkpad systemd[1]: Started Lock X session using sxlock.
Mär 18 22:54:13 thinkpad systemd[1]: sxlock.service: main process exited, code=exited, status=217/USER
Mär 18 22:54:13 thinkpad systemd[1]: Unit sxlock.service entered failed state.
~ journalctl -b _PID=18078
-- Logs begin at Mi 2013-12-04 22:23:53 CET, end at Di 2014-03-18 22:59:05 CET. --
Mär 18 22:54:13 thinkpad systemd[18078]: Failed at step USER spawning /usr/bin/sxlock: No such process
I enabled the service via systemctl enable sxlock
. I guess you have to adapt your service file so that users can start it via systemctl enable sxlock@<user>.service
. At the moment your username is still hardcoded in the service file.
Oops, I should have not blindly copied the file, sorry about that...
There is a problem with the sxlock@.service
approach, on multi-user systems the X server would be locked by one user only, there is no way to know which user is currently logged in. Therefore, sxlock@.service
is useful only on single-user systems.
There is an alternative for multi-user systems called xss-lock. Unfortunately there is currently no way to disable X screensaver events, which is why I still use the sxlock.service
approach.
For now I have just removed sxlock.service
altogether and covered the topic in README, the users should choose the way they like. If there is ever a clean way to make it work 100%, I will add it back. Let me know if there are any more troubles!
Works perfectly. Thanks again! I added the information on the service file creation to the Arch Wiki.
https://wiki.archlinux.org/index.php/List_of_applications/Security#Screen_lockers
Hi there,
Thanks a lot for sxlock! I have a question.
How would you best use sxlock to have the screen locked on resume from hibernation/suspend?
Would you use the systemd suspend target for that?
Thanks for your advice!