nova-shell/shell/modules/CpuModule.qml

38 lines
1 KiB
QML

import QtQuick
import Quickshell
import "." as M
import "../services" as S
import "../applets" as C
M.BarModule {
id: root
active: S.Modules.cpu.enable
spacing: Math.max(1, S.Theme.moduleSpacing - 2)
tooltip: "CPU: " + S.CpuService.usage + "% @ " + S.CpuService.freqGhz.toFixed(2) + " GHz"
panelNamespace: "nova-cpu"
panelContentWidth: 260
panelComponent: Component {
C.CpuApplet {
width: parent.width
processes: root._procs.processes
accentColor: root.accentColor
active: root._showPanel
}
}
property M.ProcessList _procs: M.ProcessList {
sortBy: "cpu"
active: root._showPanel
onProcessesChanged: root.keepPanelOpen(300)
}
M.BarIcon {
icon: "\uF2DB"
anchors.verticalCenter: parent.verticalCenter
}
M.BarLabel {
label: S.CpuService.usage.toString().padStart(2) + "%@" + S.CpuService.freqGhz.toFixed(2)
minText: "99%@9.99"
anchors.verticalCenter: parent.verticalCenter
}
}