nova-shell/shell/modules/IdleInhibitorModule.qml

29 lines
813 B
QML

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