I’m sorry because I did not provide an explanation.
loginctl--lock-sessions.service systemd unit is only invoked when computer reached the
systemd sleep.target which is called when computer goes to
loginctl--lock-sessions.service is never invoked by the screensaver.
You can rename the
loginctl--lock-sessions.service by using the name you want.
loginctl--lock-sessions.service rely only on systemd mechanism and just launch
loginctl lock-sessions. Unit is invoked by the
sleep.target which is called by
systemd-hybrid-sleep.service … without additional package … only the base system.
This file is part of systemd.
systemd is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
This unit do the following actions:
First one :
ExecStartPre=/usr/bin/logger --tag “loginctl” --priority auth.info “Session: Locking all user sessions”
This will cause logger to write to the journal log an event:
juil. 05 04:46:46 … loginctl: Session: Locking all user sessions
lock-sessions Screen lock all current sessions
So after restoring your computer from suspend or hibernate you can search in journal log if
loginctl--lock-sessions.service has been launched by the
sleep.target and if the
sleep.target has been invoked … using
Using the logger tag:
$ journalctl -t loginctl
Using the systemd unit name:
$ journalctl -u loginctl–lock-sessions.service
This is only a little workaround to force screen to be locked on sleep.
You can replace
loginctl lock-sessions with whatever you want coming from additional screen locking tools.
Regarding the mate screensaver (inactivity screensaver), i don’t know what to say … because I have troubles with it … sometimes screen is well locked and sometimes not … so now WIN+L is a reflex !