KDE Plasma 5 ロック画面で Linux を一時停止します。

KDE Plasma 5 ロック画面で Linux を一時停止します。

TLDR:KDE LockScreenでどのように切断しますか?

私はKDEのデフォルトのロック画面を使用していますが、少し設定できますKdeロック画面の設定 しかし、ロック画面でコンピュータを停止する方法を見つけられず、必要に応じてパスワードを入力して停止する必要がありますが、これはあまりにも不便です。

現在の一時停止ボタンを追加するために、KDEプラズマロック画面ファイル(特にLockScreenUi.qml)を修正しました。しかし、多分これはより簡単な方法ですか?

うん、見たことあるレディット投稿kde フォーラムの一部の投稿と同様に、解決策はありません。

私の設定:

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

パッチ自体はデフォルトでデフォルトアイコンを含む一時停止ボタンを追加し、PowerDevil KDEサービスを使用して一時停止します(この使用ログアウトファイルが見つかりました)。

自分の責任で使用してください。

--- /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")
                     }
                 ]

編集1:

この機能に関する報告がありました。KDEバグトラッカー(ありがとうございます。ラーケンシュタインリンク用)

ベストアンサー1

パッチありがとうございます。本当に効果があると思います!

物理電源キーを扱うのと同じです。

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

kded5 5.67.0plasmashell 5.17.5(Gentoo)操作が確認されました。

アップデート 2020-06: kde-plasma/plasma-workspace-5.18.5 のアップデートパッチ

--- /usr/share/plasma/look-and-feel/org.kde.breeze.desktop/contents/lockscreen/LockScreenUi.qml.orig    2020-06-25 00:50:49.181771074 +0300
+++ /usr/share/plasma/look-and-feel/org.kde.breeze.desktop/contents/lockscreen/LockScreenUi.qml 2020-06-25 00:56:23.750323655 +0300
@@ -38,6 +38,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: {
@@ -125,6 +137,8 @@
             }
         }
         Keys.onPressed: {
+            if (event.key == 16908292) performOperation("suspendToRam")
+            if (event.key == 16777399) performOperation("suspendToRam")
             uiVisible = true;
             event.accepted = false;
         }
@@ -279,6 +293,11 @@
                         anchors{
                             verticalCenter: parent.top
                         }
+                    },
+                    ActionButton {
+                        text: i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Suspend")
+                        iconSource: "system-suspend"
+                        onClicked: performOperation("suspendToRam")
                     }
                 ]
 

おすすめ記事