nova-shell/modules/IdleInhibitor.qml

26 lines
693 B
QML

import QtQuick
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")
property bool active: false
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
}
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: root.active = !root.active
}
}