Add services/Demand.qml, which holds one count on a service's demand counter while active. It replaces 13 hand-written consumer counters across the bar, Control Center, dashboard, media and desktop widgets. The desktop Cava widget now releases Cava while its desktop is covered. Add components/JumpValue.qml for the "animate only visible jumps" rule shared by the dashboard gauge and resource bars. Move the Settings sidebar (search and navigation) into settings/SettingsSidebar.qml and the drag handle into settings/controls/SettingsDragArea.qml, halving Settings.qml. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
37 lines
1.4 KiB
QML
37 lines
1.4 KiB
QML
import QtQuick
|
|
import "../../components"
|
|
import "../../services"
|
|
import "../../core"
|
|
|
|
GlassButton {
|
|
property string metric: "cpu"
|
|
implicitHeight: ModuleRegistry.pillHeight
|
|
Demand {
|
|
service: MetricsService
|
|
}
|
|
text: {
|
|
switch (metric) {
|
|
case "cpu":
|
|
return "CPU " + MetricsService.value(MetricsService.cpu.percent, "%");
|
|
case "cpuTemperature":
|
|
return "CPU " + MetricsService.value(MetricsService.cpu.temperature, "°C");
|
|
case "gpu":
|
|
return "GPU " + MetricsService.value(MetricsService.gpu.percent, "%");
|
|
case "gpuTemperature":
|
|
return "GPU " + MetricsService.value(MetricsService.gpu.temperature, "°C");
|
|
case "ram":
|
|
return "RAM " + MetricsService.value(MetricsService.ram.percent, "%");
|
|
case "storage":
|
|
return "Disk " + MetricsService.value((MetricsService.snapshot.storage || [
|
|
{}
|
|
])[0]?.percent, "%");
|
|
default:
|
|
return "↓ " + MetricsService.bytes(MetricsService.network.download) + "/s ↑ " + MetricsService.bytes(MetricsService.network.upload) + "/s";
|
|
}
|
|
}
|
|
readonly property bool network: metric === "networkThroughput"
|
|
accented: network && ShellState.controlCenterOpen
|
|
onClicked: network ? ShellState.toggleControlCenter() : ShellState.openSettings("metrics")
|
|
Accessible.name: text
|
|
}
|