LavaUI docs GitHub

Lava

Lava is a desktop environment for Linux: a Wayland compositor, the shell around it, and the everyday applications, all written with one UI framework of its own, LavaUI. The framework is declarative Swift, shaped like SwiftUI, and it is documented here.

The Lava desktop: LavaExplorer with two panes and tabs, LavaWeather's forecast, the panel's global menu and status icons, and the dock showing a window preview
The Lava desktop. The file manager, the weather app, the panel with its global menu, and the dock with its window previews are all LavaUI, running as clients of the Lava compositor.

What is in it

  • The compositor. Windows, workspaces, title bars, shadows and frosted glass, multiple monitors, and fullscreen games handed straight to the display.
  • The shell. A panel with the global menu, clock and calendar, network, Bluetooth, sound and media controls, and notifications; a dock, a launcher, an app switcher, a lock screen and Settings.
  • The applications. A terminal, a file manager that also reaches FTP and SFTP servers, a text editor, an image viewer, a PDF reader, a video player, a screenshot tool and a password manager.

Each is an ordinary LavaUI app. It lays out and records what to draw, and the compositor draws it on the one GPU, so an app needs no graphics stack of its own. The same app also runs in a window of its own on any other desktop.

Why this exists

Writing a native application for Linux is a mess. There are two toolkits that matter, Qt in C++ and GTK in C, and both carry decades of history that shows the moment you open their documentation: object systems bolted onto languages that did not have them, signal and slot plumbing, a build step of their own, and a model of UI where you construct widgets and then keep them in sync with your data by hand. Neither feels like how UI is written anywhere else any more.

The desktops built on top of them were not much better. Every one I tried was either bloated or buried under settings — a panel for everything, and none of the defaults quite right. XFCE came closest: small, fast, gets out of the way. But it is X11 only, and that is not where Linux is going.

So Lava is both halves: a UI framework, and a desktop written with it.

Why Swift, and why SwiftUI-shaped

Honestly, for the fun of it. Apple supports Swift on Linux properly, and it seemed like a good joke to borrow — steal, partially replicate — the shape of their framework: body, @State, stacks and modifiers, a view that is a function of its data. I was also moved by Zuck's critique that Apple has stopped inventing anything, just ships the same thing again every year, and it felt like the moment to walk into Apple's playground and build a SwiftUI that isn't tied to Apple platforms. A small spark was all it took, so he should probably be careful what he says in public. I am not sure if he is aware of this. Anyway, the joke turned out to work. Swift's C++ interop means the renderer can stay in C++ and Vulkan while the application code reads like SwiftUI.

The look follows the same taste. The design is openly macOS-inspired, because I think it is the best one there is.

What the desktop does differently

Lava's compositor is opinionated rather than configurable. A few things it does that I missed everywhere else:

  • A dock per workspace. Each workspace keeps its own set of pinned icons, so work and personal life live on separate desks and do not bleed into each other.
  • Links open where you are. Click a link in Teams on workspace 2 and it opens in the browser window on workspace 2 — not in whichever browser window happened to be used last, on some other workspace. That one annoyed the hell out of me on XFCE.

Overall, the desktop does what most people need, nothing more, and does it fast.

The framework

Views are written the way SwiftUI writes them, and everything underneath belongs to Lava: Yoga for layout, FreeType and HarfBuzz for text, and a renderer in C++ and Vulkan that draws everything in a single pipeline.

Documentation

New here? Start with Getting started, then the API guide. The reference below is generated from the source's /// comments.

LavaUI

Views, state, layout, drawing, input and the app loop.

2483 declarations · 2266 documented

LavaHost

Opens an app as a window or as a compositor client, chosen at run time.

11 declarations · 11 documented

LavaClient

Runs an app as a client of the Lava compositor, with no GPU of its own.

133 declarations · 113 documented

LavaText

Text editing without a GPU: cursors, selection, undo, search, wrapping.

142 declarations · 142 documented

LavaMenu

Application menus as data, for whatever draws them.

119 declarations · 119 documented

Control plane

The compositor's control plane: fonts, images, surfaces, present and input.

441 declarations · 280 documented

Articles

  • How LavaUI draws

    A Swift UI framework for a Wayland desktop where applications have no renderer at all. They write draw commands into shared memory and stop. One process owns the GPU for the whole desktop.

Guides