From 0b09f9ad6288ab8c0dc9cd73fd0aac22592b1936 Mon Sep 17 00:00:00 2001 From: Damocles Date: Mon, 13 Apr 2026 10:59:07 +0200 Subject: [PATCH 1/2] fix idle inhibitor: keep process running instead of backgrounding --- modules/IdleInhibitor.qml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/modules/IdleInhibitor.qml b/modules/IdleInhibitor.qml index d11f56e..e34b380 100644 --- a/modules/IdleInhibitor.qml +++ b/modules/IdleInhibitor.qml @@ -11,17 +11,16 @@ M.BarIcon { icon: root.active ? "\uF06E" : "\uF070" + // The inhibitor process — stays running while active Process { - id: toggle - command: ["sh", "-c", root.active ? "pkill -x systemd-inhibit || true" : "systemd-inhibit --what=idle --who=nova-shell --why=user sleep infinity &"] + id: inhibitor + command: ["systemd-inhibit", "--what=idle", "--who=nova-shell", "--why=user", "sleep", "infinity"] + running: root.active } MouseArea { anchors.fill: parent cursorShape: Qt.PointingHandCursor - onClicked: { - root.active = !root.active; - toggle.running = true; - } + onClicked: root.active = !root.active } } From 22ea9b0df1e7221cf94002a8c9690cdee182b126 Mon Sep 17 00:00:00 2001 From: Damocles Date: Mon, 13 Apr 2026 15:11:48 +0200 Subject: [PATCH 2/2] idle inhibitor: show blocking inhibitors in tooltip, poll only while hovered --- modules/IdleInhibitor.qml | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/modules/IdleInhibitor.qml b/modules/IdleInhibitor.qml index e34b380..5a60515 100644 --- a/modules/IdleInhibitor.qml +++ b/modules/IdleInhibitor.qml @@ -1,23 +1,47 @@ import QtQuick +import Quickshell import Quickshell.Io import "." as M M.BarIcon { id: root color: root.active ? (parent?.accentColor ?? M.Theme.base05) : M.Theme.base04 - tooltip: "Idle inhibition: " + (root.active ? "active" : "inactive") + tooltip: { + const parts = ["Idle inhibition: " + (root.active ? "active" : "inactive")]; + if (root._inhibitors) + parts.push(root._inhibitors); + return parts.join("\n"); + } property bool active: false + property string _inhibitors: "" icon: root.active ? "\uF06E" : "\uF070" - // The inhibitor process — stays running while active Process { id: inhibitor command: ["systemd-inhibit", "--what=idle", "--who=nova-shell", "--why=user", "sleep", "infinity"] running: root.active } + // Poll current inhibitors + Process { + id: listProc + running: true + command: ["sh", "-c", "systemd-inhibit --list 2>/dev/null | grep -i idle | awk '{print $NF}' | sort -u | tr '\\n' ', ' | sed 's/, $//'"] + stdout: StdioCollector { + onStreamFinished: root._inhibitors = text.trim() ? "Blocked by: " + text.trim() : "" + } + } + + Timer { + interval: 5000 + running: root._hovered + repeat: true + triggeredOnStart: true + onTriggered: listProc.running = true + } + MouseArea { anchors.fill: parent cursorShape: Qt.PointingHandCursor