Galaxy Shell / docs
Docs / Architecture and development

UI rendering and the compositor process

openspec/changes/archive/2026-10-27-ui-compositor-rendering/design.md · Edit on GitHub ↗

On this page

UI rendering and the compositor process

Doc status: history. Assessment of 2026-10-27; its decision lives in docs/architecture-decisions.md. Checked 2026-11-10.

Assessment of 2026-10-27 in response to a question from the project owner. It does not change the approved decision of React + Electron and a separate Smithay compositor, and it does not authorize a migration. It is necessary to tell apart the production of the UI pixels from the composition of those pixels with the windows in the final image.

Later decision of the project owner

The project owner prefers to keep all visual components web, including bars, widgets, controls, custom frames and the overview interface. This decision replaces the initial hybrid recommendation of this assessment. Smithay composes the surfaces and implements transforms, effects and input/window management; the web engine draws the components. This record did not migrate any of the existing native elements.

Paths assessed

Path What it runs in the compositor Possible benefits Main cost
Integrated native UI Layout, text, drawing and interaction of own elements in Rust Same presentation cycle, shared graphics resources and less communication for these elements Integrate text, input, accessibility and layout; a failure can affect the desktop
Embedded web engine Integration of an HTML/CSS/JS engine and its graphics output Keep the web language and control its presentation Complex integration; an embedded engine can still use several processes; preserve isolation
Web UI in a separate process Composition of the buffers produced by the web client Reuse React/Electron and recover the UI without restarting the compositor Synchronize frames, buffers and events between processes

The first option can be built: Smithay provides rendering/composition, and the project integrates the chosen toolkit or native drawing. This can serve frames, focus indicators, the overview, the cursor and fixed controls. React DOM and the current inline HTML components still depend on a web engine.

Electron uses several processes. Hosting its main process together with another layer does not automatically put the web renderer in the same process. An integration of CEF or another engine also needs to examine the effective process model. Electron process model.

Compose the UI without merging the processes

The compositor can treat the chat as a Wayland surface and apply scale, opacity, transforms and effects on its buffers. The Smithay proof already transformed terminal windows this way, keeping the logical size of the client. The desktop bridge and the presentation modes of the shell are already implemented and were exercised in nested Electron/Foot; see the Smithay state and evidence. This does not prove performance or parity of the direct session. The production of the web pixels stays in the client; the final composition happens in Smithay.

Another alternative is offscreen rendering. Electron offers bitmap output or a shared GPU texture; the documentation requires a native module to consume the latter. The accelerated bitmap mode involves a read from GPU to CPU, so do not assume it is efficient. Offscreen preserves the web engine and its processes. Electron offscreen rendering.

Smithay GlesRenderer offers DMA-BUF import. This capability and the Electron offscreen output are candidate pieces, not a ready bridge or proof of compatibility between the two APIs. It would be necessary to validate handles and transport on Linux, formats/modifiers, synchronization, GPU/driver, lifetime and release of the buffers. We would also need to forward input, focus, coordinates, scale, popups, clipboard, IME and accessibility. GlesRenderer, lifetime of Electron textures.

Separate processes do not imply copying each frame through the CPU. Buffer sharing can avoid that path, but before phase 1 of glass from the alpha channel the compositor offered no linux-dmabuf, so clients use wl_shm (details). The conventional Wayland client is the first option to measure before developing a custom graphics transport.

Benefits and limits

Native drawing in the compositor can eliminate a client and its communication for the migrated elements, coordinate animations directly with the windows and avoid duplication of graphics resources. These are possible gains, subject to the toolkit, the driver and the implementation. Moving only frames and indicators does not eliminate Chromium while the chat and inline HTML stay web.

Putting web layout or execution in the process that serves input and presentation increases coupling: blocks, excessive consumption or failures in that layer can interrupt the desktop. Threads help distribute work, but they do not offer the failure isolation of separate processes. Generated code must stay isolated from the compositor and from the privileged tools, and recovery must survive the UI it recovers.

Direction adopted after the clarification

Keep all visual components in React/HTML/CSS in the web host, preserving protected sending and recovery and the isolation of generated documents. Smithay controls the composition of these components and of the external windows. The use of web technology does not give the surfaces direct access to the privileged tools.

Measure the existing Wayland path first. Investigate offscreen with a shared texture if a concrete limitation of integration or cost appears. Both allow web components; the choice of transport does not require drawing native controls in the compositor. Integrating the web engine into the compositor process remains a separate question, with no migration authorized in this record.

Compare input-to-presentation latency, dropped frames, GPU time, CPU and total memory of the processes under the same load: a long chat, inline components, animated thumbnails and external applications. Also test renderer crash, a frozen UI, focus, text selection and recovery. No benchmark of this comparison was run in this assessment.

On 2026-10-31 a second web bar joined the first: the top bar is its own Electron window in a 32px strip at the top, and the bottom bar keeps only the workspace tabs. Smithay places both and reserves their strips; all their controls stay HTML/CSS in the protected host. See the decision.

Glass and the shape channel (2026-11-04)

The project owner observed that glass and liquid glass are rendering effects that only the compositor can compute over the wallpaper and the application windows, and that the split adds a cost this assessment did not weigh. The alpha-mask record finds two causes that do not require merging the processes. Before that plan the compositor offered clients no linux-dmabuf, so every frame crossed wl_shm. The shape of the glass travels by a side channel (DOM measurement, HTTP, core, control socket). Its plan adds dmabuf first, then measures carrying the shape in the alpha channel of the web surface. Not implemented.

Exploration of visual effects

The proposal for visual effects, 3D and shaders records possibilities for CSS, web scenes and composition of real windows, with a suggested sequence of experiments. The exploration was saved at the request of the project owner; later, he authorized the first aurora experiment on the wallpaper. The document tells this implementation apart from the other effects that are still proposed and records its validation limits.