Lay the Control Center out as a resizable, editable grid
Modules are tiles on a 4-column grid, each 1x1 to 4x4 and adapting its layout to its size. Edit Controls in the panel reorders by dragging, resizes from a corner handle, removes with a badge and adds from a tray. Connectivity splits into Wi-Fi, Bluetooth and Network tiles and Audio into Sound and Microphone; right-clicking Sound extends it with output devices and a volume slider per app. Adds a Caffeine tile. Config version 2 migrates existing layouts in place. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0dcf37346c
commit
11bdc4c751
32 files changed
+2147
-355
No files matched your search
@@ -1,10 +1,99 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import ".."
|
||||
import "../../core"
|
||||
import "../../metrics"
|
||||
import "../../services"
|
||||
import "../../theme"
|
||||
|
||||
MetricsCard {
|
||||
compact: true
|
||||
radius: Math.max(12, Theme.radius * 0.75)
|
||||
color: Theme.fill
|
||||
border.color: Theme.hairline
|
||||
// CPU, RAM and GPU load. Small tiles show the figures as text (1×1 just CPU);
|
||||
// wide tall tiles show ring gauges. Click opens the Metrics settings.
|
||||
CCModule {
|
||||
id: root
|
||||
readonly property var stats: [
|
||||
{
|
||||
label: "CPU",
|
||||
value: MetricsService.cpu.percent
|
||||
},
|
||||
{
|
||||
label: "RAM",
|
||||
value: MetricsService.ram.percent
|
||||
},
|
||||
{
|
||||
label: "GPU",
|
||||
value: MetricsService.gpu.percent
|
||||
}
|
||||
]
|
||||
readonly property int shown: compact ? 1 : Math.min(stats.length, wide ? cols : rows)
|
||||
readonly property bool gauges: wide && tall
|
||||
objectName: "metricsTile"
|
||||
hovered: area.containsMouse
|
||||
Demand {
|
||||
service: MetricsService
|
||||
}
|
||||
MouseArea {
|
||||
id: area
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: ShellState.openSettings("metrics")
|
||||
}
|
||||
GridLayout {
|
||||
visible: !root.gauges
|
||||
anchors.fill: parent
|
||||
anchors.margins: 8
|
||||
columns: root.wide ? root.shown : 1
|
||||
rowSpacing: 4
|
||||
columnSpacing: 4
|
||||
Repeater {
|
||||
model: root.stats.slice(0, root.shown)
|
||||
ColumnLayout {
|
||||
id: stat
|
||||
required property var modelData
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
spacing: 0
|
||||
Text {
|
||||
text: MetricsService.value(stat.modelData.value, "%")
|
||||
color: Theme.text
|
||||
font.pixelSize: 17
|
||||
font.weight: Font.DemiBold
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignBottom
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
Text {
|
||||
text: stat.modelData.label
|
||||
color: Theme.textSecondary
|
||||
font.pixelSize: 10
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignTop
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Row {
|
||||
visible: root.gauges
|
||||
anchors.centerIn: parent
|
||||
Repeater {
|
||||
model: root.gauges ? root.stats.slice(0, root.shown) : []
|
||||
Item {
|
||||
id: cell
|
||||
required property var modelData
|
||||
readonly property real scaleBy: Math.min(1, (root.width - 16) / root.shown / 100, (root.baseHeight - 16) / 106)
|
||||
width: 100 * scaleBy
|
||||
height: 106 * scaleBy
|
||||
MetricGauge {
|
||||
label: cell.modelData.label
|
||||
value: cell.modelData.value
|
||||
scale: cell.scaleBy
|
||||
transformOrigin: Item.TopLeft
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user