1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-31 08:52:49 -05:00

lock: bypass custom commands in ipc

This commit is contained in:
bbedward
2025-10-19 23:15:32 -04:00
parent daf3525e80
commit 0cb081a6d0
2 changed files with 16 additions and 7 deletions

View File

@@ -20,7 +20,7 @@ Scope {
function lock() { function lock() {
if (SettingsData.customPowerActionLock && SettingsData.customPowerActionLock.length > 0) { if (SettingsData.customPowerActionLock && SettingsData.customPowerActionLock.length > 0) {
Quickshell.execDetached(SettingsData.customPowerActionLock.split(" ")) Quickshell.execDetached(["sh", "-c", SettingsData.customPowerActionLock])
return return
} }
if (!processingExternalEvent && SettingsData.loginctlLockIntegration && DMSService.isConnected) { if (!processingExternalEvent && SettingsData.loginctlLockIntegration && DMSService.isConnected) {
@@ -110,7 +110,16 @@ Scope {
target: "lock" target: "lock"
function lock() { function lock() {
root.lock() if (!root.processingExternalEvent && SettingsData.loginctlLockIntegration && DMSService.isConnected) {
DMSService.lockSession(response => {
if (response.error) {
console.warn("Lock: Failed to call loginctl.lock:", response.error)
root.shouldLock = true
}
})
} else {
root.shouldLock = true
}
} }
function demo() { function demo() {

View File

@@ -187,7 +187,7 @@ Singleton {
// Hyprland fallback // Hyprland fallback
Hyprland.dispatch("exit") Hyprland.dispatch("exit")
} else { } else {
Quickshell.execDetached(SettingsData.customPowerActionLogout.split(" ")) Quickshell.execDetached(["sh", "-c", SettingsData.customPowerActionLogout])
} }
} }
@@ -195,7 +195,7 @@ Singleton {
if (SettingsData.customPowerActionSuspend.length === 0) { if (SettingsData.customPowerActionSuspend.length === 0) {
Quickshell.execDetached([isElogind ? "loginctl" : "systemctl", "suspend"]) Quickshell.execDetached([isElogind ? "loginctl" : "systemctl", "suspend"])
} else { } else {
Quickshell.execDetached(SettingsData.customPowerActionSuspend.split(" ")) Quickshell.execDetached(["sh", "-c", SettingsData.customPowerActionSuspend])
} }
} }
@@ -203,7 +203,7 @@ Singleton {
if (SettingsData.customPowerActionHibernate.length === 0) { if (SettingsData.customPowerActionHibernate.length === 0) {
Quickshell.execDetached([isElogind ? "loginctl" : "systemctl", "hibernate"]) Quickshell.execDetached([isElogind ? "loginctl" : "systemctl", "hibernate"])
} else { } else {
Quickshell.execDetached(SettingsData.customPowerActionHibernate.split(" ")) Quickshell.execDetached(["sh", "-c", SettingsData.customPowerActionHibernate])
} }
} }
@@ -211,7 +211,7 @@ Singleton {
if (SettingsData.customPowerActionReboot.length === 0) { if (SettingsData.customPowerActionReboot.length === 0) {
Quickshell.execDetached([isElogind ? "loginctl" : "systemctl", "reboot"]) Quickshell.execDetached([isElogind ? "loginctl" : "systemctl", "reboot"])
} else { } else {
Quickshell.execDetached(SettingsData.customPowerActionReboot.split(" ")) Quickshell.execDetached(["sh", "-c", SettingsData.customPowerActionReboot])
} }
} }
@@ -219,7 +219,7 @@ Singleton {
if (SettingsData.customPowerActionPowerOff.length === 0) { if (SettingsData.customPowerActionPowerOff.length === 0) {
Quickshell.execDetached([isElogind ? "loginctl" : "systemctl", "poweroff"]) Quickshell.execDetached([isElogind ? "loginctl" : "systemctl", "poweroff"])
} else { } else {
Quickshell.execDetached(SettingsData.customPowerActionPowerOff.split(" ")) Quickshell.execDetached(["sh", "-c", SettingsData.customPowerActionPowerOff])
} }
} }