Lock screen on suspend

Like many others, I have had problems getting the screen to lock on returning from suspending my laptop. There are many threads here and bug reports (just search for "suspend lock").

In my case, I managed to solve the problem by changing two variables using dconf editor:
org.mate.power-manager.lock-use-screensaver - false
org.mate.screensaver.lock-delay - 0
And reboot.

I'm not sure which of these did the trick but I offer the information to others who might be struggling.

I'm running 20.04.4 LTS (Focal Fossa) 64-bit with MATE 1.24.0, all fully updated as of 19.5.2022.

I have the same issue on 22.04, MATE 1.26.0. I tried changing the two variables you mentioned, but unfortunately it looks like this trick doesn't work on 22.04. (At least for me.)

Anyway, I agree it seems that something is bugged.

I was able to overcome the issue using a systemd service to invoke loginctl as recommended here:

But it does seem like kind of a kludge. I wish this wasn't necessary.

So it turns out, and I have no idea why, I actually need both your solution and the other solution in place for the lock to actually work. I only realized this when I went to remove the edits with dconf-editor, thinking they were unnecessary, and then the lock stopped working again.

I did a little bit of testing, and without lock-use-screensaver and lock-delay set, loginctl lock-sessions doesn't seem to do anything at all, which seems very weird. I'm wondering if I did something to mess up my install because of how painful this has been to get working.