nosignal-shell/modules/dashboard/Performance.qml
28allday 83c6b62c13 feat(nosignal): finish Nerd Font icon remap — core surfaces
Convert remaining reachable surfaces to NsIcon (launcher, utilities, windowinfo,
sidebar, dashboard, notification toast, shared controls IconTextButton/Menu/
SplitButton/ToggleButton/CollapsibleSection/CustomSpinBox, CoverArt). Handles
the `sourceComponent: MaterialIcon {` form and icon-via-alias controls.

- IconTextButton: alias -> plain `icon` property + bound NsIcon (cross-file alias
  to a custom property was rejected).
- Reverted IconButton `font:` (the controls-wide font->fontStyle sweep wrongly
  hit ButtonBase, which uses font not fontStyle).
- Glyphs map: +31 names (dashboard/utilities/launcher leftovers) — no "?" glyphs.

Old collapsed bar + old lock sub-components left as-is (unused, never render).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-14 12:59:28 +01:00

146 lines
4.6 KiB
QML

import "performance"
import QtQuick
import QtQuick.Layouts
import Quickshell.Services.UPower
import Caelestia.Config
import Caelestia.Services
import qs.components
import qs.services
Item {
id: root
implicitWidth: placeholder.active ? Tokens.sizes.dashboard.perfPlaceholderWidth : content.implicitWidth
implicitHeight: placeholder.active ? placeholder.implicitHeight + Tokens.padding.extraLarge * 2 : content.implicitHeight
Loader {
id: placeholder
anchors.centerIn: parent
active: !Config.dashboard.performance.showCpu && !(Config.dashboard.performance.showGpu && Gpu.type !== Gpu.None) && !Config.dashboard.performance.showMemory && !Config.dashboard.performance.showStorage && !Config.dashboard.performance.showNetwork && !(UPower.displayDevice.isLaptopBattery && Config.dashboard.performance.showBattery)
asynchronous: true
sourceComponent: ColumnLayout {
spacing: Tokens.spacing.medium
NsIcon {
Layout.alignment: Qt.AlignHCenter
icon: "tune"
fontStyle: Tokens.font.icon.builders.extraLarge.scale(2).build()
color: Colours.palette.m3onSurfaceVariant
}
StyledText {
Layout.topMargin: -Tokens.spacing.small
Layout.alignment: Qt.AlignHCenter
text: qsTr("No widgets enabled")
font: Tokens.font.title.large
color: Colours.palette.m3onSurface
}
StyledText {
Layout.alignment: Qt.AlignHCenter
text: qsTr("Enable widgets in the dashboard settings")
font: Tokens.font.body.small
color: Colours.palette.m3onSurfaceVariant
}
}
}
RowLayout {
id: content
anchors.left: parent.left
anchors.right: parent.right
spacing: Tokens.spacing.medium
visible: !placeholder.active
ColumnLayout {
id: mainColumn
Layout.fillWidth: true
spacing: Tokens.spacing.medium
RowLayout {
spacing: Tokens.spacing.medium
visible: cpuCard.active || gpuCard.active
WrappedLoader {
id: cpuCard
active: Config.dashboard.performance.showCpu
sourceComponent: HeroCard {
icon: "memory"
label: qsTr("CPU")
subLabel: Cpu.name
usage: Cpu.percentage
temperature: Cpu.temperature
accent: Colours.palette.m3primary
ServiceRef {
service: Cpu
}
}
}
WrappedLoader {
id: gpuCard
active: Config.dashboard.performance.showGpu && Gpu.type !== Gpu.None
sourceComponent: HeroCard {
icon: "desktop_windows"
label: qsTr("GPU")
subLabel: Gpu.name
usage: Gpu.percentage
temperature: Gpu.temperature
accent: Colours.palette.m3secondary
ServiceRef {
service: Gpu
}
}
}
}
RowLayout {
spacing: Tokens.spacing.medium
visible: storageCard.active || networkCard.active || memoryCard.active
WrappedLoader {
id: storageCard
active: Config.dashboard.performance.showStorage
sourceComponent: StorageCard {}
}
WrappedLoader {
id: networkCard
active: Config.dashboard.performance.showNetwork
sourceComponent: NetworkCard {}
}
WrappedLoader {
id: memoryCard
active: Config.dashboard.performance.showMemory
sourceComponent: MemoryCard {}
}
}
}
WrappedLoader {
Layout.fillWidth: false
active: UPower.displayDevice.isLaptopBattery && Config.dashboard.performance.showBattery
sourceComponent: BatteryTank {}
}
}
component WrappedLoader: Loader {
Layout.fillWidth: true
Layout.fillHeight: true
visible: active
}
}