Files
z-bar-qt/Modules/Lock/Resources.qml
T

84 lines
1.4 KiB
QML

pragma ComponentBehavior: Bound
import QtQuick
import QtQuick.Layouts
import M3Shapes
import ZShell.Services
import qs.Components
import qs.Config
import qs.Effects
CustomRect {
id: root
readonly property real fontScale: {
const diff = width / 391 - 1; // 391 is the width at 1080 height screen
return 1 + Math.pow(Math.abs(diff), 0.8) * Math.sign(diff);
}
color: DynamicColors.tPalette.m3surfaceContainer
implicitHeight: layout.implicitHeight + layout.anchors.margins * 2
radius: Appearance.rounding.small
ServiceRef {
service: Cpu
}
ServiceRef {
service: Memory
}
ServiceRef {
service: Storage
}
RowLayout {
id: layout
anchors.fill: parent
anchors.margins: Appearance.padding.large
spacing: Appearance.spacing.large
Resource {
id: cpu
fgColor: DynamicColors.palette.m3primary
icon: "memory"
value: Cpu.percentage
}
Resource {
fgColor: DynamicColors.palette.m3tertiary
icon: "memory_alt"
value: Memory.percentage
}
Resource {
fgColor: DynamicColors.palette.m3secondary
icon: "hard_disk"
value: Storage.percentage
}
}
component Resource: CircularProgress {
id: res
required property string icon
Layout.fillWidth: true
implicitSize: width
Behavior on clampedVal {
Anim {
}
}
MaterialIcon {
anchors.centerIn: parent
color: res.fgColor
font.pointSize: Appearance.font.size.extraLarge
text: res.icon
}
}
}