Files
z-bar-qt/Modules/Resources.qml
Zacharias-Brohn b28eec5930 resource popout
2026-02-28 13:57:29 +01:00

97 lines
1.8 KiB
QML

pragma ComponentBehavior: Bound
import QtQuick
import Quickshell
import QtQuick.Layouts
import Quickshell.Wayland
import qs.Modules
import qs.Config
import qs.Effects
import qs.Components
Item {
id: root
required property PersistentProperties visibilities
clip: true
implicitHeight: 34
implicitWidth: rowLayout.implicitWidth + Appearance.padding.small * 2
CustomRect {
id: backgroundRect
color: DynamicColors.tPalette.m3surfaceContainer
implicitHeight: 22
radius: height / 2
anchors {
left: parent.left
right: parent.right
verticalCenter: parent.verticalCenter
}
StateLayer {
onClicked: root.visibilities.resources = !root.visibilities.resources
}
}
RowLayout {
id: rowLayout
anchors.centerIn: parent
spacing: 6
MaterialIcon {
Layout.alignment: Qt.AlignVCenter
color: DynamicColors.palette.m3onSurface
font.pointSize: 14
text: "memory_alt"
}
Resource {
Layout.alignment: Qt.AlignVCenter
mainColor: DynamicColors.palette.m3primary
percentage: ResourceUsage.memoryUsedPercentage
warningThreshold: 95
}
MaterialIcon {
Layout.alignment: Qt.AlignVCenter
color: DynamicColors.palette.m3onSurface
font.pointSize: 14
text: "memory"
}
Resource {
mainColor: DynamicColors.palette.m3secondary
percentage: ResourceUsage.cpuUsage
warningThreshold: 80
}
MaterialIcon {
Layout.alignment: Qt.AlignVCenter
color: DynamicColors.palette.m3onSurface
font.pointSize: 14
text: "gamepad"
}
Resource {
mainColor: DynamicColors.palette.m3tertiary
percentage: ResourceUsage.gpuUsage
}
MaterialIcon {
Layout.alignment: Qt.AlignVCenter
color: DynamicColors.palette.m3onSurface
font.pointSize: 14
text: "developer_board"
}
Resource {
mainColor: DynamicColors.palette.m3primary
percentage: ResourceUsage.gpuMemUsage
}
}
}