nova-shell/shell/modules/IdleInhibitorModule.qml

31 lines
827 B
QML

import QtQuick
import Quickshell
import "." as M
import "../services" as S
M.BarIcon {
id: root
color: S.IdleInhibitService.active ? S.Theme.base09 : root.accentColor
tooltip: {
const parts = ["Idle inhibition: " + (S.IdleInhibitService.active ? "active" : "inactive")];
if (S.IdleInhibitService.inhibitors)
parts.push(S.IdleInhibitService.inhibitors);
return parts.join("\n");
}
icon: S.IdleInhibitService.active ? "\uF06E" : "\uF070"
Timer {
interval: 5000
running: root._hovered
repeat: true
triggeredOnStart: true
onTriggered: S.IdleInhibitService.refreshInhibitors()
}
MouseArea {
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: S.IdleInhibitService.toggle()
}
}