nova-shell/shell/modules/IdleInhibitorModule.qml

31 lines
894 B
QML

import QtQuick
import Quickshell
import "." as M
import "../services" as S
import NovaStats as NS
M.BarModule {
id: root
active: NS.ModulesService.idleInhibitorEnable
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 ? NS.ThemeService.base09 : root.accentColor
icon: S.IdleInhibitService.active ? "\uF06E" : "\uF070"
anchors.verticalCenter: parent.verticalCenter
}
}