跪拜 Guibai
← All articles
Frontend · Flutter · Android

Starling Turns Flutter Into a Full Linux Desktop Environment

By 恋猫de小郭 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

Starling demonstrates that a UI framework's retained-mode scene graph and GPU compositor can replace the entire display server layer, collapsing the stack that normally separates app toolkits from window managers. For developers watching the convergence of system and application rendering, this is a working proof-of-concept running real X11 and Wayland clients on bare DRM/KMS.

Summary

Starling is a 335,000-line open-source project that creates a complete Linux desktop environment by rewriting Flutter's Dart framework in Swift and keeping the Flutter Engine as the GPU compositor. It boots directly to DRM/KMS, bypassing Wayland compositors like Mutter or KWin, and runs its own Wayland and X11 servers to host external applications.

External app windows from Chrome, VS Code, or Blender are treated as Flutter TextureWidgets, so title bars, shadows, rounded corners, and animations all live inside the same Flutter layer tree. The project already supports multi-monitor setups, tiling, Spaces, Mission Control, a Dock, and first-party Swift apps for settings, file management, and a terminal.

A key architectural inversion is at play: instead of Flutter apps running on top of a desktop compositor, the Flutter framework itself becomes the compositor. The Dart-to-Swift port preserves Flutter's widget, element, and render-object model, including setState and the multi-child diffing algorithm, while mapping Dart mixins to Swift protocols and class hierarchies.

Takeaways
Starling boots directly to DRM/KMS without a traditional display server, using Flutter Engine's rasterizer and GPU compositor as the final compositing layer.
The Dart framework was ported to Swift line-for-line, preserving Widget, Element, RenderObject, setState, and the multi-child diffing algorithm.
Dart mixins are mapped to Swift using protocols with default extensions, class-based inheritance, or split host-protocol patterns depending on state and inheritance needs.
External application windows become Flutter TextureWidgets via DMA-BUF zero-copy GPU buffer sharing, with CPU upload fallbacks for older apps.
A custom Wayland server (several thousand lines of C) and a minimal built-in X11 server handle protocol translation without depending on wlroots or XWayland.
The project totals 335,000 lines of code, with 273,000 lines in the framework port and 62,000 lines in the shell, servers, and apps.
Starling installs on Ubuntu 26.04 and appears as a selectable session in GDM.
Conclusions

Starling inverts the standard Linux graphics stack: the UI framework is no longer a client of the compositor but is the compositor itself, which eliminates an entire layer of scene-graph duplication between the toolkit and the display server.

Treating external app windows as TextureWidgets means every window automatically inherits Flutter's animation, clipping, and compositing capabilities without per-app cooperation, a model that could simplify desktop effects infrastructure.

The Dart-to-Swift port is mechanically faithful rather than idiomatic, suggesting the goal was preserving Flutter's exact rendering and layout semantics rather than creating a SwiftUI-like API.

Building a custom Wayland server and X11 server from scratch instead of using wlroots or XWayland gives Starling full control over buffer handling and texture registration but multiplies the protocol surface the project must maintain.

Concepts & terms
DRM/KMS
Direct Rendering Manager and Kernel Mode Setting — Linux kernel subsystems that allow userspace to control display connectors, modes, and GPU buffers directly, bypassing a display server.
DMA-BUF
A Linux kernel mechanism for sharing GPU buffers across process boundaries and device drivers using file descriptors, enabling zero-copy texture sharing between applications and compositors.
Client-to-server inversion
Starling's term for flipping the typical stack: instead of apps connecting to a compositor, the UI framework itself becomes the server that apps connect to, with their surfaces rendered as widgets in its scene graph.
TextureWidget
A Flutter widget that displays an externally-managed GPU texture, commonly used for video or camera previews; Starling uses it to embed the live window surfaces of other Linux applications.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗