The Lock signal is not emitted by systemd-logind when the screen is locked
The problem
Since Gnome depends on Systemd, it should be compatible with all Systemd components. According to the systemd-logind documentation the Lock signal will be sent to D-Bus by systemd-logind when the screen is locked. This does not happen when the lock screen is activated.
Compatibility is important for 3rd-party software to be able to react to the session lock event without depending on Gnome components (in particular the ActiveChanged event sent by org.gnome.ScreenSaver).
How to reproduce
-
Make sure that automatic screen locking is enabled.
-
Start monitoring D-Bus for the Lock signal.
sudo dbus-monitor --system "type='signal',interface='org.freedesktop.login1.Session',member='Lock'"
-
Lock the screen by pressing
Super + L
key combination. -
Unlock the screen and check the console output.
Expected result
The monitoring tool should show a captured signal like below.
signal time=1541358211.693950 sender=:1.9 -> destination=(null destination) serial=2008 path=/org/freedesktop/login1/session/_36; interface=org.freedesktop.login1.Session; member=Lock
Actual result
The Lock signal is not recorded by the monitoring tool.
Remarks
When the screen is locked by a Systemd provided tool loginctl, like sudo loginctl lock-sessions --no-ask-password
, then the signal is emitted as expected.
Interestingly the Unlock signal is emitted, but that's because GDM calls the UnlockSession() method of the logind session object.
Environment
Software | Version |
---|---|
Gnome Shell | 3.30.1 |
Systemd | 239.2 |
D-Bus | 1.12.10 |
OS | Arch Linux |
Linux | 4.18.16 |