TLDR: How to suspend from KDE LockScreen?

I'm using KDE's default lockscreen which you can somewhat configure Kde lockscreen config But I haven't found a way to suspend my PC from the lockscreen, so I had to enter my password and then suspend every time I needed it which is very inconvenient.

Currently I modified KDE plasma lockscreen files (LockScreenUi.qml in particular) to add Suspend button. But maybe the is a simpler way to do this?

Also yes, I have seen reddit post and a few posts on kde forums without any solutions.

My configuration:

uname -a
Linux neko 4.15.14-1-ARCH #1 SMP PREEMPT Wed Mar 28 17:34:29 UTC 2018 x86_64 GNU/Linux

kded5 --version
kded5 5.45.0

plasmashell --version
plasmashell 5.12.5

The patch itself, it basically adds Suspend button with default icon and uses PowerDevil KDE service to suspend (found this usage logout files)


--- /usr/share/plasma/look-and-feel/org.kde.breeze.desktop/contents/lockscreen/LockScreenUi.qml 2018-05-01 16:03:40.000000000 +0300
+++ backups/kde-plasma-lockscreen/LockScreenUi.qml  2018-05-05 19:56:59.764353585 +0300
@@ -31,6 +31,18 @@

     colorGroup: PlasmaCore.Theme.ComplementaryColorGroup

+    function performOperation(what) {
+        var service = dataEngine.serviceForSource("PowerDevil");
+        var operation = service.operationDescription(what);
+        service.startOperationCall(operation);
+    }
+    PlasmaCore.DataSource {
+      id: dataEngine
+      engine: "powermanagement"
+      connectedSources: ["PowerDevil"]
+    }
     Connections {
         target: authenticator
         onFailed: {
@@ -174,6 +186,11 @@
                         onClicked: mainStack.push(switchSessionPage)
                         // the current session isn't listed in the model, hence a check for greater than zero, not one
                         visible: (sessionsModel.count > 0 || sessionsModel.canStartNewSession) && sessionsModel.canSwitchUser
+                    },
+                    ActionButton {
+                      text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Suspend")
+                      iconSource: "system-suspend"
+                      onClicked: performOperation("suspendToRam")


There is already a report for the feature on KDE bugtracker (thanks Lekensteyn for the link)

  • Did you try to look for / file a bug report for this feature request? – AF7 May 6 '18 at 9:34
  • @AF7 Well, I have seen multiple posts about it but no bug/feature requests on kde trackers. Maybe I should file one, indeed. But I wanted to try finding a solution here before I go there, maybe I just missed it somewhere. – lundibundi May 6 '18 at 10:03
  • There are two feature requests related to this, see bugs.kde.org/show_bug.cgi?id=392798 (and a linked report from 2014). – Lekensteyn Jun 13 '18 at 17:17
  • Your patch does not seem to do anything on kded5 5.48.0 and plasmashell 5.13.4 (Manjaro). Am I missing the place where I should look? – Pastafarianist Aug 23 '18 at 7:10
  • @Pastafarianist well, I have it on kded5 5.49.0 and plasmashell 5.13.4 (Arch) and it works (I have Suspend button in lockscreen), perhaps the original file updated and the patch doesn't apply cleanly, but you can always add it manually. – lundibundi Aug 25 '18 at 19:09

thanks for the patch, it works like a charm!

same to handle the physical power key:

      Keys.onPressed: {
+            if (event.key == 16777399) performOperation("suspendToRam")

confirmed to work on kded5 5.67.0 and plasmashell 5.17.5 (Gentoo).

|improve this answer|||||

Thank you very much! Works well.

My laptop has a sleep key as well, so I added one more line:

      Keys.onPressed: {
+            if (event.key == 16908292) performOperation("suspendToRam")
            uiVisible = true;
            event.accepted = false;
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.