96 lines
2.9 KiB
QML
96 lines
2.9 KiB
QML
pragma ComponentBehavior: Bound
|
|
|
|
import QtQuick
|
|
import Quickshell
|
|
import QtQuick.Layouts
|
|
import ZShell.Services
|
|
import qs.Helpers
|
|
import qs.Modules
|
|
import qs.Config
|
|
import qs.Components
|
|
|
|
CustomRect {
|
|
id: root
|
|
|
|
required property bool horizontal
|
|
required property PersistentProperties visibilities
|
|
|
|
anchors.fill: parent
|
|
clip: true
|
|
color: visibilities.resources ? DynamicColors.palette.m3primary : DynamicColors.tPalette.m3surfaceContainer
|
|
implicitHeight: horizontal ? Config.bar.height + Appearance.padding.smallest * 2 : gridLayout.implicitHeight + Appearance.padding.normal * 2
|
|
implicitWidth: horizontal ? gridLayout.implicitWidth + Appearance.padding.larger * 2 : Config.bar.height
|
|
radius: Appearance.rounding.full
|
|
|
|
StateLayer {
|
|
color: root.visibilities.resources ? DynamicColors.palette.m3onPrimary : DynamicColors.palette.m3onSurface
|
|
|
|
onClicked: root.visibilities.resources = !root.visibilities.resources
|
|
}
|
|
|
|
GridLayout {
|
|
id: gridLayout
|
|
|
|
anchors.centerIn: parent
|
|
anchors.horizontalCenterOffset: root.horizontal ? 0 : 1
|
|
anchors.verticalCenterOffset: root.horizontal ? 0 : -3
|
|
columnSpacing: Appearance.spacing.smaller
|
|
columns: root.horizontal ? -1 : 1
|
|
|
|
ServiceRef {
|
|
service: Gpu
|
|
}
|
|
|
|
ServiceRef {
|
|
service: Cpu
|
|
}
|
|
|
|
ServiceRef {
|
|
service: Memory
|
|
}
|
|
|
|
Resource {
|
|
Layout.alignment: Qt.AlignVCenter
|
|
Layout.fillHeight: root.horizontal
|
|
Layout.fillWidth: !root.horizontal
|
|
horizontal: root.horizontal
|
|
icon: "memory"
|
|
iconColor: root.visibilities.resources ? DynamicColors.palette.m3onPrimary : DynamicColors.palette.m3onSurface
|
|
mainColor: root.visibilities.resources ? DynamicColors.palette.m3onPrimary : DynamicColors.palette.m3primary
|
|
percentage: Cpu.percentage
|
|
warningThreshold: 95
|
|
}
|
|
|
|
Resource {
|
|
Layout.fillHeight: root.horizontal
|
|
Layout.fillWidth: !root.horizontal
|
|
horizontal: root.horizontal
|
|
icon: "memory_alt"
|
|
iconColor: root.visibilities.resources ? DynamicColors.palette.m3onPrimary : DynamicColors.palette.m3onSurface
|
|
mainColor: root.visibilities.resources ? DynamicColors.palette.m3onPrimary : DynamicColors.palette.m3secondary
|
|
percentage: Memory.percentage
|
|
warningThreshold: 80
|
|
}
|
|
|
|
Resource {
|
|
Layout.fillHeight: root.horizontal
|
|
Layout.fillWidth: !root.horizontal
|
|
horizontal: root.horizontal
|
|
icon: "gamepad"
|
|
iconColor: root.visibilities.resources ? DynamicColors.palette.m3onPrimary : DynamicColors.palette.m3onSurface
|
|
mainColor: root.visibilities.resources ? DynamicColors.palette.m3onPrimary : DynamicColors.palette.m3tertiary
|
|
percentage: Gpu.percentage
|
|
}
|
|
|
|
Resource {
|
|
Layout.fillHeight: root.horizontal
|
|
Layout.fillWidth: !root.horizontal
|
|
horizontal: root.horizontal
|
|
icon: "developer_board"
|
|
iconColor: root.visibilities.resources ? DynamicColors.palette.m3onPrimary : DynamicColors.palette.m3onSurface
|
|
mainColor: root.visibilities.resources ? DynamicColors.palette.m3onPrimary : DynamicColors.palette.m3primary
|
|
percentage: Gpu.memoryUsed / Gpu.memoryTotal
|
|
}
|
|
}
|
|
}
|