The Phosphor.ControlCenter tile surface: the quick-settings panel a shell opens from the bar, holding toggles for network, bluetooth, audio, brightness and the rest. Pure QML, themed through `phosphor-theme` and built on the `phosphor-shell-widgets` atoms.
Phase 4.4 deliverable per Lambent's docs/design/04-implementation-plan.md.
Own the rail list, the drill-in detail view, and the routing between them. The surface knows how a control tile behaves; it does not know what any particular tile controls.
Tiles are supplied through a provider backed by a Registry<IControlCenterTileFactory>. Per the factory contract a null return means "unavailable in this environment" (no service, no hardware) and is not an error.
The built-in tiles ship here, and they import Phosphor.Service.* modules, but the library still links no service: those modules are registered by the host process before it loads any QML (each service exposes a hand-rolled registerQmlTypes(); see phosphor-shell/src/main.cpp), so they resolve at runtime. That is the same arrangement the bar's service-bound widgets use. A host that registers only some services gets working tiles for those and inert ones for the rest.
Like OSDHost and ToastHost, ControlCenter renders into whatever item it is parented to and owns no surface of its own. The shell decides how it appears:
Neither choice reaches into this module, so switching is a wiring change in the shell rather than a rewrite here.
The choice does decide whether the keyboard works, though. In the bar socket this surface has no window of its own, and the bar asks for no keyboard interactivity (keyboardFocus: PanelWindow.None, which is ordinary panel behaviour), so the compositor routes no key to it: the tiles' Tab order, the detail panel's Escape and every key handler in this module are inert there. All of it works in a standalone popout. Pointer interaction is the same either way, and nothing here is reachable only by keyboard. See the control-center section of Lambent's docs/design/04-implementation-plan.md for what closing that would cost.
| Component | Role |
|---|---|
| ControlCenter | Rail list + detail routing. Materialises tiles from a provider, owns their teardown, applies each tile's layout hint, and arbitrates the one-detail-view-at-a-time rule. |
| Tile | Chrome for a toggle: a 52 px rail with icon, label, live readout, a 2 px state-axis underline, and an optional detail chevron. Spans the pane. |
| SliderTile | Chrome for a range (volume, brightness): the same rail, where the underline itself is the slider, with a tappable icon for mute. Spans the pane. |
| DetailPanel | The drill-in view: titled surface with a back affordance that slides over the rails. Content comes from the tile. |
| Tile | Binds to | Shape |
|---|---|---|
| NetworkTile | NetworkHost.wirelessEnabled (the radio, never NM's global switch) | toggle |
| BluetoothTile | the first BluetoothAdapter.powered | toggle |
| IdleTile | an injected IdleService, holding one inhibition cookie | toggle |
| AudioTile | the default PwNode sink's volume and mute | slider |
| BrightnessTile | the first Display-kind BrightnessDevice | slider |
Layout is the host's job: a tile declares spansRow and ControlCenter stretches it to the pane, so a tile never has to know the pane's width. Every shipped control is a rail that spans, and a provider-supplied tile that declares otherwise is honoured.
Tile.active is driven by the service the tile binds to, and toggled only asks the service to change. A tile that latched locally would show a state the system never reached whenever a request failed or something else changed it, so active follows the service's echo instead.
import Phosphor.ControlCenter
ControlCenter {
anchors.fill: parent
provider: controlCenterController // Registry-backed, from the shell
tileIds: ["network", "bluetooth", "audio", "brightness"]
}A tile is authored against the shared chrome:
Tile {
id: root
// NetworkHost is registered as a creatable type, not a singleton, so
// the tile declares its own.
NetworkHost {
id: host
}
iconName: host.wirelessEnabled ? "network-wireless" : "network-wireless-disconnected"
label: qsTr("Wi-Fi")
sublabel: host.connectivity === NetworkHost.Full ? qsTr("Connected") : qsTr("Not connected")
active: host.wirelessEnabled
// The chevron appears because there is a detail view behind it.
// `hasDetail` is derived from this, not set.
detailTitle: qsTr("Wi-Fi")
detailContent: Component {
NetworkList {
host: host
}
}
// No local latch: write the property and let the service's own change
// signal drive `active` back.
onToggled: host.wirelessEnabled = !host.wirelessEnabled
}tests/ is a QtQuickTest harness covering the host's registry-agnostic contract: tile materialisation order, a provider returning null, the detail-view routing, and the rebuild path. The provider in those tests is a plain QML object with createTile(id, parent), which is exactly the seam the shell fills with a registry-backed controller.
Phase 4.4: in the tree. The host, the shared tile chrome, the slider variant, the detail panel and five built-in tiles are present, with a QtQuickTest suite over the host's registry-agnostic contract.
The acceptance demo is ../../examples/phosphor-control-center-demo/, a plain window that hosts the rails over the real services, so a tile whose service is missing on the machine reports itself unavailable rather than vanishing.
One thing is deliberately unfinished. DetailPanel has a content path, and a tile supplies its own view through detailTitle and detailContent, but none of the five built-ins authors one yet. hasDetail is derived from whether that content exists, so a tile without it shows no chevron rather than a chevron leading to a blank panel.
The other open item is not this module's to close: the shipped mount is the bar's socket, whose surface requests no keyboard interactivity, so the tile and panel key handlers are inert there. See "Presentation is the host's choice" above.