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

Improvement: Allow the user to perform custom power actions (#439)

This commit is contained in:
max72bra
2025-10-15 14:46:32 +02:00
committed by GitHub
parent 1976ea4d49
commit ab4f6baae6
3 changed files with 268 additions and 10 deletions

View File

@@ -178,29 +178,49 @@ Singleton {
}
function _logout() {
if (CompositorService.isNiri) {
NiriService.quit()
return
}
if (SettingsData.customPowerActionLogout.length === 0) {
if (CompositorService.isNiri) {
NiriService.quit()
return
}
// Hyprland fallback
Hyprland.dispatch("exit")
// Hyprland fallback
Hyprland.dispatch("exit")
} else {
Quickshell.execDetached(SettingsData.customPowerActionLogout.split(" "))
}
}
function suspend() {
Quickshell.execDetached([isElogind ? "loginctl" : "systemctl", "suspend"])
if (SettingsData.customPowerActionSuspend.length === 0) {
Quickshell.execDetached([isElogind ? "loginctl" : "systemctl", "suspend"])
} else {
Quickshell.execDetached(SettingsData.customPowerActionSuspend.split(" "))
}
}
function hibernate() {
Quickshell.execDetached([isElogind ? "loginctl" : "systemctl", "hibernate"])
if (SettingsData.customPowerActionHibernate.length === 0) {
Quickshell.execDetached([isElogind ? "loginctl" : "systemctl", "hibernate"])
} else {
Quickshell.execDetached(SettingsData.customPowerActionHibernate.split(" "))
}
}
function reboot() {
Quickshell.execDetached([isElogind ? "loginctl" : "systemctl", "reboot"])
if (SettingsData.customPowerActionReboot.length === 0) {
Quickshell.execDetached([isElogind ? "loginctl" : "systemctl", "reboot"])
} else {
Quickshell.execDetached(SettingsData.customPowerActionReboot.split(" "))
}
}
function poweroff() {
Quickshell.execDetached([isElogind ? "loginctl" : "systemctl", "poweroff"])
if (SettingsData.customPowerActionPowerOff.length === 0) {
Quickshell.execDetached([isElogind ? "loginctl" : "systemctl", "poweroff"])
} else {
Quickshell.execDetached(SettingsData.customPowerActionPowerOff.split(" "))
}
}
// * Idle Inhibitor