Skip to content

Architecture

Qwen4-Max wooo edited this page Nov 27, 2026 · 2 revisions

Architecture

Summary of docs/ARCHITECTURE.md (the full design) and docs/ALPHA-ARCHITECTURE.md (the verified alpha implementation boundary). Where the two differ, the alpha boundary is what actually ships today.

Layers

Qt Quick / QML apps (matfiles, matsettings, matterminal, ...)
    └── libm3-qt (M3Theme + Material controls)
GTK apps / legacy toolkits
    └── generated theme CSS / xrdb

matshell      panel · launcher · quick settings · notifications
    │         (Wayland client on layer-shell + xdg-shell)
matsessiond   theme engine (libm3) · wallpaper · D-Bus org.materialized.*
    │
matcomp       C++20 Wayland compositor on wlroots
    │         scene graph · DRM/KMS · libinput seat · xdg-shell ·
    │         layer-shell · screencopy
Linux kernel  DRM/KMS · evdev · cgroups v2 · namespaces · Btrfs/ext4

System services: systemd · logind · NetworkManager · BlueZ · UPower ·
                 UDisks2 · PackageKit · PipeWire · polkit

The full architecture additionally plans XWayland, ext-session-lock, workspace overview, gamma-control/Night Light and output-management protocols; those are roadmap items, not alpha features.

Components

Component Location Role
libm3 libs/libm3 Material 3 engine, C++20 with no dependencies: CAM16/HCT conversion, tonal palettes, dynamic schemes (incl. Expressive variant), wallpaper quantization, seed selection, contrast-aware color roles
libm3-qt libs/libm3-qt QML design system: M3Theme singleton and Material controls; Expressive spring motion, shape morph, emphasized typography
matcomp compositor/matcomp Real wlroots Wayland compositor: scene graph, headless + DRM/KMS backends, libinput seat, xdg-shell windows, layer-shell surfaces, workspaces, focus, snapping, maximize/fullscreen, wlr-screencopy, launch hotkeys. Alpha renders with the pixman software renderer
matsessiond shell/matsessiond Session theme daemon: decodes wallpaper with Qt, quantizes with libm3, generates light/dark schemes, atomically writes JSON/QML/GTK/xrdb artifacts + Firefox userChrome.css; D-Bus theme API
matshell shell/matshell QML shell: top panel, launcher/search over real .desktop entries, notification service, quick settings backed by PipeWire and the kernel backlight interface, XDG autostart
Applications apps/ Nine apps with real backends - see Applications
matinstall-core installer/matinstall-core Independently validates and plans an installation. Destructive operations require explicit opt-in, root and a real disk probe; privileged path is polkit-gated (D-027). The graphical wizard is roadmap

Design-system data flow

wallpaper.png ─▶ decode ─▶ QuantizerCelebi ─▶ Score ─▶ seed ARGB
                                                        │
                     user prefs (variant, contrast, dark, accent override)
                                                        ▼
                                                  libm3 DynamicScheme
                                                        │
      ┌────────────┬────────────┬─────────────┬─────────┴──┬───────────┐
      ▼            ▼            ▼             ▼            ▼           ▼
 scheme.json   theme.qml     gtk.css   qt-palette.conf    xrdb    icons/tint

Two colour propagation paths:

  • Live (fast): M3Theme in each QML process subscribes to org.materialized.Theme1.SchemeChanged; on signal it re-reads /run/user/$UID/materialized/theme/scheme-<mode>.json and re-binds every role. The whole desktop - including already-open apps - recolours within one frame.
  • Static (compat): generated gtk.css / qt-palette.conf / xrdb for toolkits that cannot subscribe.

No process may invent colours. Components ask for roles by name (e.g. M3Theme.secondaryContainer); the role table is generated from design/tokens/materialized.tokens.json, and the generator fails the build if a token references an undefined role.

IPC contracts

Interface Bus / path Purpose
org.materialized.Theme1 session bus Theme controls and SchemeChanged notification (incl. SetVariant for the Expressive color style)
org.materialized.Shell1 session bus Shell control
org.materialized.Installer1 system bus, polkit-gated Privileged installer operations
Compositor control socket $XDG_RUNTIME_DIR/matcomp-control.sock Workspace control line protocol (status, workspace N, next, prev, launch, close); driven by the matcompctl CLI and the shell's workspace chips (0.3.0)
File contracts /run/user/$UID/materialized/theme/ Scheme JSON/QML/GTK/xrdb artifacts, Firefox userChrome.css

matshell also implements org.freedesktop.Notifications; notification rules and Do-Not-Disturb are owned by matsessiond (D-024).

Session lifecycle

There is no display manager (D-005). Firmware (UEFI or BIOS) hands off to GRUB 2, which loads the kernel; systemd boots straight to the compositor on the primary seat. In the live ISO, tty1 auto-logins and the session launcher starts matcomp, matsessiond and matshell; the QML shell writes the Materialized session started serial marker only after its window is genuinely exposed. Getty TTYs remain available as a text fallback.

The full design describes a systemd user-session chain (matcomp.service → wayland-session.target → matsessiond, matshell, PipeWire, polkit agent) and boot budget targets: kernel→compositor < 2.0 s, compositor→interactive shell < 1.2 s, cold boot to usable desktop < 8 s, checked by tests/vm/boot-time.py. These are targets of the full vision, not alpha guarantees.

Repository layout

apps/        the application suite
build/       bootstrap, build, test and release scripts
compositor/  matcomp
design/      tokens and wallpaper
docs/        architecture, decisions, roadmap, release checklists
installer/   matinstall-core
libs/        libm3, libm3-qt
platform/    ISO build
shell/       matsessiond, matshell
tests/       unit tests and the VM harness
third_party/ vendored material-color-utilities (verification reference)
tools/       token compiler

Alpha acceptance boundary

The alpha is "done" only when: the unified CMake build succeeds; token, installer and core-app unit tests pass; a real Qt/Wayland client runs under the compositor; the ISO boots to the QML shell in both UEFI and BIOS QEMU; and a VM screenshot is captured and inspected. See Testing.

Related: Theming and Material 3, Design Decisions, Building from Source.

Clone this wiki locally