mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-05-03 19:12:11 -04:00
fix: clean up orphaned idle inhibitor processes on startup (#2324)
When quickshell crashes or is force-killed, the child systemd-inhibit process (used as fallback when native IdleInhibitor is unavailable) gets reparented to PID 1 and continues to block idle indefinitely. This causes hypridle to ignore all idle timeout rules even though the idle inhibitor widget appears inactive after restart. Add a cleanup step during initialization that kills any orphaned systemd-inhibit processes from previous sessions.
This commit is contained in:
@@ -66,6 +66,7 @@ Singleton {
|
||||
detectHibernateProcess.running = true;
|
||||
detectPrimeRunProcess.running = true;
|
||||
detectWtypeProcess.running = true;
|
||||
cleanupOrphanedInhibitors();
|
||||
log.info("Native inhibitor available:", nativeInhibitorAvailable);
|
||||
if (!SettingsData.loginctlLockIntegration) {
|
||||
log.debug("loginctl lock integration disabled by user");
|
||||
@@ -462,6 +463,26 @@ Singleton {
|
||||
}
|
||||
}
|
||||
|
||||
// Kill orphaned idle inhibitor processes left behind by previous quickshell sessions.
|
||||
// When quickshell crashes or is force-killed, the child systemd-inhibit process gets
|
||||
// reparented to PID 1 and continues to block idle indefinitely.
|
||||
function cleanupOrphanedInhibitors() {
|
||||
if (nativeInhibitorAvailable) return;
|
||||
orphanCleanupProcess.running = true;
|
||||
}
|
||||
|
||||
Process {
|
||||
id: orphanCleanupProcess
|
||||
running: false
|
||||
command: ["pkill", "-f", "systemd-inhibit --what=idle --who=quickshell.*sleep infinity"]
|
||||
|
||||
onExited: function (exitCode) {
|
||||
if (exitCode === 0) {
|
||||
log.info("Cleaned up orphaned idle inhibitor process(es) from a previous session");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: DMSService
|
||||
|
||||
|
||||
Reference in New Issue
Block a user