1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-24 13:32:50 -05:00

session: handle hibernate error

fixes #308
This commit is contained in:
bbedward
2026-01-05 12:01:17 -05:00
parent 64310854a6
commit 850e5b6572

View File

@@ -103,6 +103,27 @@ Singleton {
}
}
Process {
id: hibernateProcess
running: false
property string errorOutput: ""
stderr: SplitParser {
splitMarker: "\n"
onRead: data => hibernateProcess.errorOutput += data.trim()
}
onExited: function (exitCode) {
if (exitCode === 0) {
errorOutput = "";
return;
}
ToastService.showError("Hibernate failed", errorOutput);
errorOutput = "";
}
}
Process {
id: detectPrimeRunProcess
running: false
@@ -274,11 +295,13 @@ Singleton {
}
function hibernate() {
if (SettingsData.customPowerActionHibernate.length === 0) {
Quickshell.execDetached([isElogind ? "loginctl" : "systemctl", "hibernate"]);
hibernateProcess.errorOutput = "";
if (SettingsData.customPowerActionHibernate.length > 0) {
hibernateProcess.command = ["sh", "-c", SettingsData.customPowerActionHibernate];
} else {
Quickshell.execDetached(["sh", "-c", SettingsData.customPowerActionHibernate]);
hibernateProcess.command = [isElogind ? "loginctl" : "systemctl", "hibernate"];
}
hibernateProcess.running = true;
}
function suspendThenHibernate() {