I find the “Sleep” button dangerous (what if someone put the system to sleep while there is something running), but turning off the screen(s) instead would be useful.
Press the ESC key.
Press the ESC key.
Only toggles a password prompt for me.
What plasma version / Graphics Platform are you on?
The ESC key works here perfectly on Plasma 6 Wayland, even with my “Turn off screen: Never” on AC power management setting, all Monitors are turning off.
On Plasma 5 X11 I had some sort of “xset dpms off and then lock” hotkey (not useable from the lockscreen itself, though), but could even be that ESC would have worked and I was just unaware of it back then, don’t know.
Or, if you are on the current Plasma 6
Does your Monitor turn off, after 20 Seconds of lockscreen, if you set it to?
I already have this… I even have a notification script that turns off the display(s) on lockup (because IIRC in my current Plasma version the power management only turns off the main display).
But if anyone/anything moves the mouse or touches the keyboard, I have to login again to turn off the displays. My current workaround is a command in KDEconnect so I can do it from my phone but I would like anyone to be able to turn off the screen (and nothing more).
Looks like in /usr/share/plasma/shells/org.kde.plasma.desktop/contents/lockscreen/LockScreenUi.qml
is the Keys.onEscapePressed
event handled.
At least on my Plasma 6.
Maybe that can be modified to run your script instead. Or even a additional button added in that QML.
But I looked at that language only very shallow and my last tinkering with was years ago. Unfortunately can’t probably help you any further with that.
Still on Plasma 5 on my Kubuntu 22.04, and no such file, but /usr/share/plasma/look-and-feel/org.kde.breeze.desktop/contents/lockscreen/LockScreenUi.qml
looks like a good replacement. Now off to learn QML