mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-10 15:52:58 -04:00
Add hibernate support to power menus
This commit is contained in:
@@ -109,7 +109,7 @@ Singleton {
|
||||
})
|
||||
}
|
||||
|
||||
if (hibernateTimeout > 0) {
|
||||
if (hibernateTimeout > 0 && SessionService.hibernateSupported) {
|
||||
hibernateMonitor = Qt.createQmlObject(qmlString, root, "IdleService.HibernateMonitor")
|
||||
hibernateMonitor.enabled = Qt.binding(() => root._enableGate && root.enabled && root.idleMonitorAvailable && root.hibernateTimeout > 0)
|
||||
hibernateMonitor.respectInhibitors = Qt.binding(() => root.respectInhibitors)
|
||||
|
||||
@@ -13,12 +13,14 @@ Singleton {
|
||||
|
||||
property bool hasUwsm: false
|
||||
property bool isElogind: false
|
||||
property bool hibernateSupported: false
|
||||
property bool inhibitorAvailable: true
|
||||
property bool idleInhibited: false
|
||||
property string inhibitReason: "Keep system awake"
|
||||
|
||||
Component.onCompleted: {
|
||||
detectElogindProcess.running = true
|
||||
detectHibernateProcess.running = true
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +45,16 @@ Singleton {
|
||||
}
|
||||
}
|
||||
|
||||
Process {
|
||||
id: detectHibernateProcess
|
||||
running: false
|
||||
command: ["grep", "-q", "disk", "/sys/power/state"]
|
||||
|
||||
onExited: function (exitCode) {
|
||||
hibernateSupported = (exitCode === 0)
|
||||
}
|
||||
}
|
||||
|
||||
Process {
|
||||
id: uwsmLogout
|
||||
command: ["uwsm", "stop"]
|
||||
|
||||
Reference in New Issue
Block a user