How to lock screen after a certain amount of time

I have been using Plasma for years at this point and I still don’t understand how to use the screen locking and power management modules.

I can get the screen to lock after a certain amount of time, and I can get the screen to turn off after a certain amount of time, but not both, and neither reliably. If I set “Lock screen automatically” in Screen Locking and “Turn off screen” in Power Management to the same amount of time, it will do only one OR the other, with no way for me to pridict which it will do. If I set “Turn off screen” to be longer than “Lock screen automatically” it will, again, do one OR the other, at the “Lock screen automatically” timer.

Firstly, I don’t know why these are separate modules. Get rid of the Screen Locking module and allow “Lock screen” to be selected in Suspend Session > When inactive in the Power Management module.


This would also allow you to set different screen locking timeouts depending on power mode (why would you want this? To lock screen and turn off the screen in the same squence, e.g. lock screen then turn it off, or to do them both at the same time).
The only 2 other settings in Screen Locking can surely also be moved to the Power Management (or I guess Screen Locking and Power Management) module.

And the “Turn off screen:” “x minutes” “When locked:/when locked and unlocked” interface is incredibly confusing.
image
image
That second dropdown is either its own setting,

Turn off screen in 24 minutes when unlocked. Turn off screen immediately when locked.

or part of the preceding sentence,

Turn off screen in 24 minutes when locked and unlocked

depending on the what is selected in the second dropdown — if I understand correctly?

(Just pointing out, if lock screen existed under suspend session, you would only need a separate “Turn off screen when locked” setting and you’d avoid the confusion. There is also no way to currently set “Dim automatically” when locked, so you could also add that. And the other problem currently is that setting “turn off screen when locked” to “immediately” means you can’t then set a timer for locking after inactivity when actually on the lock screen, so the “immediately” setting should be replaced by a separate checkbox, something like “Also turn off screen when locking”)

So I’m still not sure if I’m encountering a bug with the screen off/locking behaviour or if I misunderstand the settings.

But at the very least I need a way to make it reliably lock when left unattended.

MetaL

100% reliable for me - regardless of the state of the desktop.

Do you use the “delay before password required” setting?

No delay, locked is locked.

Never mind. Thought maybe that was what was different, but I just tested using “Require password immediately” and the two settings still interfere with each other. In this case it locked, but I know that doesn’t mean it will do that every time.

I have now tested in a fresh profile (new user) and pretty quickly had the screen fail to turn off when set to the same timeout as the lock screen. I will keep testing for a bit and see if I can reproduce the failure to lock.

Have now recreated it.

My other theory was that maybe something was blocking screen off and locking. All I did on the new user was open up settings and start playing around with the screen locking setup. Then I saw there were some flatpak updates available, and pressed update all in discover, and immediately afterwards (with updates completed) the screen turned off at the timer but did not lock.

I left it to time out again and that time it worked.

Settings

Screen Locking: 1 minute
Require password: 3 seconds
Screen Dimming: 30 seconds
Suspend Session When inactive: Do nothing
Turn off screen: 1 minute (will also fail to lock when set to longer or shorter durations than Screen Locking), When locked: Immediately

Everything else default.

Platform: NixOS, Plasma 6.6.4