property real fontSizeXS: 9 property real fontSizeS: 10 property real fontSizeM: 11 property real fontSizeL: 13 property real fontSizeXL: 16 property real fontSizeXXL: 18 property real fontSizeXXXL: 24
99 lines
2.7 KiB
QML
99 lines
2.7 KiB
QML
import QtQuick
|
|
import Quickshell
|
|
import qs.Commons
|
|
import qs.Services
|
|
import qs.Widgets
|
|
|
|
Row {
|
|
id: root
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
spacing: Style.marginS * scaling
|
|
visible: (Settings.data.bar.showSystemInfo)
|
|
|
|
Rectangle {
|
|
// Let the Rectangle size itself based on its content (the Row)
|
|
width: row.width + Style.marginM * scaling * 2
|
|
|
|
height: Math.round(Style.barHeight * 0.75 * scaling)
|
|
radius: Math.round(Style.radiusM * scaling)
|
|
color: Color.mSurfaceVariant
|
|
border.color: Color.mOutline
|
|
border.width: Math.max(1, Math.round(Style.borderS * scaling))
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
Item {
|
|
id: mainContainer
|
|
anchors.fill: parent
|
|
anchors.leftMargin: Style.marginS * scaling
|
|
anchors.rightMargin: Style.marginS * scaling
|
|
|
|
Row {
|
|
id: row
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
spacing: Style.marginS * scaling
|
|
Row {
|
|
id: cpuUsageLayout
|
|
spacing: Style.marginXS * scaling
|
|
|
|
NIcon {
|
|
id: cpuUsageIcon
|
|
text: "speed"
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
}
|
|
|
|
NText {
|
|
id: cpuUsageText
|
|
text: `${SystemStatService.cpuUsage}%`
|
|
font.pointSize: Style.fontSizeS * scaling
|
|
font.weight: Style.fontWeightMedium
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
verticalAlignment: Text.AlignVCenter
|
|
color: Color.mPrimary
|
|
}
|
|
}
|
|
|
|
// CPU Temperature Component
|
|
Row {
|
|
id: cpuTempLayout
|
|
// spacing is thin here to compensate for the vertical thermometer icon
|
|
spacing: Style.marginXXS * scaling
|
|
|
|
NIcon {
|
|
text: "thermometer"
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
}
|
|
|
|
NText {
|
|
text: `${SystemStatService.cpuTemp}°C`
|
|
font.pointSize: Style.fontSizeS * scaling
|
|
font.weight: Style.fontWeightMedium
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
verticalAlignment: Text.AlignVCenter
|
|
color: Color.mPrimary
|
|
}
|
|
}
|
|
|
|
// Memory Usage Component
|
|
Row {
|
|
id: memoryUsageLayout
|
|
spacing: Style.marginXS * scaling
|
|
|
|
NIcon {
|
|
text: "memory"
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
}
|
|
|
|
NText {
|
|
text: `${SystemStatService.memoryUsageGb}G`
|
|
font.pointSize: Style.fontSizeS * scaling
|
|
font.weight: Style.fontWeightMedium
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
verticalAlignment: Text.AlignVCenter
|
|
color: Color.mPrimary
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|