Initial commit of the Quickshell desktop suite: bar, dock, launcher, settings, Control Center, dashboard, OSD, lock screen, desktop widgets, plugin host with the vendored Noctalia/Omarchy compatibility layer, helpers, packaging, tests and phase documentation. Includes the optimization work so far: usage widgets and dashboard gauges no longer animate continuously, desktop widgets pause while covered, system controls stop flickering on background polls, dock app matching uses an indexed catalog, and workspace ghosts are created only for occupied slots. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
172 lines
6.1 KiB
QML
172 lines
6.1 KiB
QML
pragma ComponentBehavior: Bound
|
|
import QtQuick
|
|
import QtQuick.Layouts
|
|
import "../components"
|
|
import "../theme"
|
|
import "../services"
|
|
import "../core"
|
|
|
|
GlassPanel {
|
|
id: root
|
|
objectName: "metricsCard"
|
|
property bool compact: false
|
|
implicitWidth: 390
|
|
implicitHeight: body.implicitHeight + 32
|
|
Component.onCompleted: MetricsService.consumers++
|
|
Component.onDestruction: MetricsService.consumers--
|
|
ColumnLayout {
|
|
id: body
|
|
anchors {
|
|
left: parent.left
|
|
right: parent.right
|
|
top: parent.top
|
|
margins: 16
|
|
}
|
|
spacing: 12
|
|
RowLayout {
|
|
Text {
|
|
text: "System"
|
|
color: Theme.text
|
|
font.pixelSize: 18
|
|
Layout.fillWidth: true
|
|
}
|
|
GlassIconButton {
|
|
text: "⚙"
|
|
onClicked: ShellState.openSettings("metrics")
|
|
Accessible.name: "Metrics settings"
|
|
}
|
|
}
|
|
RowLayout {
|
|
Layout.fillWidth: true
|
|
MetricGauge {
|
|
label: "CPU"
|
|
value: MetricsService.cpu.percent
|
|
Layout.fillWidth: true
|
|
}
|
|
MetricGauge {
|
|
label: "GPU"
|
|
value: MetricsService.gpu.percent
|
|
Layout.fillWidth: true
|
|
}
|
|
MetricGauge {
|
|
label: "RAM"
|
|
value: MetricsService.ram.percent
|
|
Layout.fillWidth: true
|
|
}
|
|
}
|
|
Canvas {
|
|
id: graph
|
|
visible: !root.compact
|
|
Layout.fillWidth: true
|
|
Layout.preferredHeight: visible ? 36 : 0
|
|
property var values: MetricsService.history
|
|
property color stroke: Theme.accent
|
|
onValuesChanged: if (visible)
|
|
requestPaint()
|
|
onStrokeChanged: requestPaint()
|
|
onWidthChanged: requestPaint()
|
|
onPaint: {
|
|
const c = getContext("2d");
|
|
c.reset();
|
|
c.strokeStyle = stroke;
|
|
c.lineWidth = 1.5;
|
|
c.beginPath();
|
|
let started = false;
|
|
for (let i = 0; i < values.length; i++) {
|
|
if (values[i].cpu == null) {
|
|
started = false;
|
|
continue;
|
|
}
|
|
const x = i * width / 59, y = height * (1 - values[i].cpu / 100);
|
|
if (!started) {
|
|
c.moveTo(x, y);
|
|
started = true;
|
|
} else
|
|
c.lineTo(x, y);
|
|
}
|
|
c.stroke();
|
|
}
|
|
Accessible.name: "CPU utilization history"
|
|
}
|
|
Text {
|
|
visible: !root.compact
|
|
text: MetricsService.cpu.name || "CPU"
|
|
color: Theme.textSecondary
|
|
elide: Text.ElideRight
|
|
Layout.fillWidth: true
|
|
}
|
|
Text {
|
|
text: "CPU " + MetricsService.value(MetricsService.cpu.temperature, " °C") + " · " + MetricsService.value((MetricsService.cpu.frequency == null ? null : MetricsService.cpu.frequency / 1000), " GHz", 2)
|
|
color: Theme.textSecondary
|
|
Layout.fillWidth: true
|
|
}
|
|
Text {
|
|
visible: !root.compact
|
|
text: MetricsService.gpu.name || "No GPU telemetry"
|
|
color: Theme.textSecondary
|
|
elide: Text.ElideRight
|
|
Layout.fillWidth: true
|
|
}
|
|
Text {
|
|
visible: !root.compact
|
|
text: "GPU " + MetricsService.value(MetricsService.gpu.temperature, " °C") + " · " + MetricsService.value(MetricsService.gpu.frequency, " MHz") + " · " + MetricsService.value(MetricsService.gpu.power, " W", 1)
|
|
color: Theme.textSecondary
|
|
Layout.fillWidth: true
|
|
}
|
|
Text {
|
|
visible: !root.compact
|
|
text: "VRAM " + MetricsService.bytes(MetricsService.gpu.used) + " / " + MetricsService.bytes(MetricsService.gpu.total)
|
|
color: Theme.textSecondary
|
|
Layout.fillWidth: true
|
|
}
|
|
Text {
|
|
text: "RAM " + MetricsService.bytes(MetricsService.ram.used) + " / " + MetricsService.bytes(MetricsService.ram.total)
|
|
color: Theme.textSecondary
|
|
Layout.fillWidth: true
|
|
}
|
|
Repeater {
|
|
model: root.compact ? [] : (MetricsService.snapshot.storage || [])
|
|
ColumnLayout {
|
|
id: disk
|
|
required property var modelData
|
|
Layout.fillWidth: true
|
|
Text {
|
|
text: disk.modelData.path + " · " + (disk.modelData.available ? MetricsService.bytes(disk.modelData.used) + " / " + MetricsService.bytes(disk.modelData.total) : "Unavailable")
|
|
color: Theme.text
|
|
elide: Text.ElideMiddle
|
|
Layout.fillWidth: true
|
|
}
|
|
Rectangle {
|
|
Layout.fillWidth: true
|
|
implicitHeight: 5
|
|
radius: 3
|
|
color: Theme.border
|
|
Rectangle {
|
|
width: parent.width * (MetricsService.stale ? 0 : (disk.modelData.percent || 0) / 100)
|
|
height: parent.height
|
|
radius: 3
|
|
color: Theme.accent
|
|
}
|
|
}
|
|
Text {
|
|
text: "Free " + MetricsService.bytes(disk.modelData.free)
|
|
color: Theme.textSecondary
|
|
visible: disk.modelData.available
|
|
}
|
|
}
|
|
}
|
|
Text {
|
|
text: "↓ " + MetricsService.bytes(MetricsService.network.download) + "/s ↑ " + MetricsService.bytes(MetricsService.network.upload) + "/s"
|
|
color: Theme.text
|
|
Layout.fillWidth: true
|
|
}
|
|
Text {
|
|
visible: MetricsService.stale || !!MetricsService.error
|
|
text: MetricsService.error || "Waiting for metrics…"
|
|
color: Theme.textSecondary
|
|
wrapMode: Text.Wrap
|
|
Layout.fillWidth: true
|
|
}
|
|
}
|
|
}
|