import QtQuick import "." StatusItem { id: root // The inhibit widget keeps the current bar's manual keep-awake control in // Quickshell state. It emits a plain signal so the bar can decide the actual // Wayland idle-inhibit mechanism without coupling this button to a window. property bool inhibiting: false property int durationIndex: 3 readonly property var durations: [ { "label": "30m", "milliseconds": 30 * 60 * 1000 }, { "label": "1h", "milliseconds": 60 * 60 * 1000 }, { "label": "2h", "milliseconds": 2 * 60 * 60 * 1000 }, { "label": "inf", "milliseconds": 0 } ] readonly property var duration: durations[durationIndex] text: `${inhibiting ? "󰅶" : "󰛊"} ${duration.label}` active: inhibiting minWidth: 58 signal inhibitChanged(bool enabled) onLeftClicked: { inhibiting = !inhibiting inhibitChanged(inhibiting) expiry.restart() } onRightClicked: { durationIndex = (durationIndex + 1) % durations.length if (inhibiting) expiry.restart() } Timer { id: expiry interval: root.duration.milliseconds repeat: false running: root.inhibiting && root.duration.milliseconds > 0 onTriggered: { root.inhibiting = false root.inhibitChanged(false) } } }