1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-08-02 03:28:28 -04:00

feat: (void-linux): add dankinstall support for auto installs

This commit is contained in:
purian23
2026-07-06 23:01:16 -04:00
parent 8a1acb63c9
commit 19a7dcf17d
15 changed files with 860 additions and 28 deletions
+34 -5
View File
@@ -14,6 +14,8 @@ Singleton {
property bool hasUwsm: false
property bool isElogind: false
property bool loginctlCommandAvailable: false
property bool systemctlCommandAvailable: false
property bool hibernateSupported: false
property bool inhibitorAvailable: true
property bool idleInhibited: false
@@ -52,6 +54,8 @@ Singleton {
repeat: false
onTriggered: {
detectElogindProcess.running = true;
detectLoginctlProcess.running = true;
detectSystemctlProcess.running = true;
detectHibernateProcess.running = true;
detectPrimeRunProcess.running = true;
if (!SettingsData.loginctlLockIntegration) {
@@ -87,6 +91,26 @@ Singleton {
}
}
Process {
id: detectLoginctlProcess
running: false
command: ["sh", "-c", "command -v loginctl"]
onExited: function (exitCode) {
loginctlCommandAvailable = (exitCode === 0);
}
}
Process {
id: detectSystemctlProcess
running: false
command: ["sh", "-c", "command -v systemctl"]
onExited: function (exitCode) {
systemctlCommandAvailable = (exitCode === 0);
}
}
Process {
id: detectHibernateProcess
running: false
@@ -325,9 +349,14 @@ Singleton {
}
}
function powerManagerCommand(action) {
const useLoginctl = isElogind || (loginctlCommandAvailable && !systemctlCommandAvailable);
return [useLoginctl ? "loginctl" : "systemctl", action];
}
function suspend() {
if (SettingsData.customPowerActionSuspend.length === 0) {
Quickshell.execDetached([isElogind ? "loginctl" : "systemctl", "suspend"]);
Quickshell.execDetached(powerManagerCommand("suspend"));
} else {
Quickshell.execDetached(["sh", "-c", SettingsData.customPowerActionSuspend]);
}
@@ -338,13 +367,13 @@ Singleton {
if (SettingsData.customPowerActionHibernate.length > 0) {
hibernateProcess.command = ["sh", "-c", SettingsData.customPowerActionHibernate];
} else {
hibernateProcess.command = [isElogind ? "loginctl" : "systemctl", "hibernate"];
hibernateProcess.command = powerManagerCommand("hibernate");
}
hibernateProcess.running = true;
}
function suspendThenHibernate() {
Quickshell.execDetached([isElogind ? "loginctl" : "systemctl", "suspend-then-hibernate"]);
Quickshell.execDetached(powerManagerCommand("suspend-then-hibernate"));
}
function suspendWithBehavior(behavior) {
@@ -359,7 +388,7 @@ Singleton {
function reboot() {
if (SettingsData.customPowerActionReboot.length === 0) {
Quickshell.execDetached([isElogind ? "loginctl" : "systemctl", "reboot"]);
Quickshell.execDetached(powerManagerCommand("reboot"));
} else {
Quickshell.execDetached(["sh", "-c", SettingsData.customPowerActionReboot]);
}
@@ -367,7 +396,7 @@ Singleton {
function poweroff() {
if (SettingsData.customPowerActionPowerOff.length === 0) {
Quickshell.execDetached([isElogind ? "loginctl" : "systemctl", "poweroff"]);
Quickshell.execDetached(powerManagerCommand("poweroff"));
} else {
Quickshell.execDetached(["sh", "-c", SettingsData.customPowerActionPowerOff]);
}