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
@@ -0,0 +1,50 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
import QtQuick
|
||||
import "../theme"
|
||||
|
||||
// Control Center grid tile. Modules fill their cells and adapt to `cols` ×
|
||||
// `rows` (1–4 each). A module can extend below its cells (`extraHeight`, e.g.
|
||||
// per-app volume); the grid moves the tiles underneath down to make room.
|
||||
// Outside the grid (Settings pages) it is a 4×1 tile that grows the same way.
|
||||
Item {
|
||||
id: root
|
||||
default property alias content: body.data
|
||||
property int cols: 4
|
||||
property int rows: 1
|
||||
// Height of the cells, without the extension; the grid sets it.
|
||||
property real baseHeight: rows * 68 + (rows - 1) * 10
|
||||
// Height wanted below the cells while extended; 0 when not.
|
||||
property real extraHeight: 0
|
||||
property bool expanded: false
|
||||
// 1×1 toggles draw as a circle centred in their cell.
|
||||
property bool round: false
|
||||
property bool hovered: false
|
||||
property color color: hovered ? Theme.hover : Theme.fill
|
||||
readonly property bool compact: cols === 1 && rows === 1
|
||||
readonly property bool wide: cols >= 2
|
||||
readonly property bool tall: rows >= 2
|
||||
readonly property bool circle: round && compact && extraHeight <= 0
|
||||
readonly property alias background: bg
|
||||
implicitWidth: 360
|
||||
implicitHeight: baseHeight + (extraHeight > 0 ? extraHeight + 10 : 0)
|
||||
Rectangle {
|
||||
id: bg
|
||||
readonly property real d: Math.min(root.width, root.baseHeight)
|
||||
x: root.circle ? (root.width - d) / 2 : 0
|
||||
width: root.circle ? d : root.width
|
||||
height: root.circle ? d : root.height
|
||||
radius: root.circle ? d / 2 : Math.min(30, root.baseHeight / 2, root.width / 2)
|
||||
color: root.color
|
||||
border.width: 1
|
||||
border.color: Theme.hairline
|
||||
Behavior on color {
|
||||
ColorAnimation {
|
||||
duration: Theme.duration / 2
|
||||
}
|
||||
}
|
||||
}
|
||||
Item {
|
||||
id: body
|
||||
anchors.fill: parent
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user