Building a Minimal Desktop from Source Components

Updated

October 30, 2026

Building a Minimal Desktop from Source Components

In this chapter, we assemble a complete, production-grade graphical desktop environment from source components. Rather than compiling all of GNOME (which requires over 100 packages), we build a modern, high-performance Wayland desktop based on Sway, Waybar, Alacritty, and Mesa.

+-----------------------------------------------------------+
|               Our Minimal Wayland Desktop Stack           |
|                                                           |
| [ Sway Compositor (wlroots) ]                             |
|  ├── [ Waybar ]          (System tray, clock, battery)    |
|  ├── [ Alacritty / Foot] (GPU-accelerated terminal)       |
|  ├── [ Wofi / Fuzzel ]   (Application launcher)          |
|  └── [ PipeWire / WirePlumber ] (Audio server)            |
|                                                           |
| [ Graphics Drivers: Mesa (radv/anv/llvmpipe) + libdrm ]   |
| [ Seat Management: seatd or systemd-logind ]              |
+-----------------------------------------------------------+

Step 1: Graphics Drivers & Mesa

All modern desktop compositing requires Direct Rendering Infrastructure (DRI) and OpenGL/Vulkan support provided by Mesa:

# Compiling Mesa with Meson:
$ meson setup build \
    --prefix=/usr \
    --buildtype=release \
    -Dplatforms=wayland \
    -Dgallium-drivers=radeonsi,iris,nouveau,swrast \
    -Dvulkan-drivers=amd,intel,swrast \
    -Dglx=disabled \
    -Degl=enabled \
    -Dgbm=enabled
$ ninja -C build -j$(nproc)
$ DESTDIR=$PKGDIR ninja -C build install

Step 2: Compiling wlroots and Sway

wlroots is a modular library maintained by Drew DeVault that abstracts away the low-level complexities of Wayland backends (DRM/KMS, libinput, EGL/GLES2).

# 1. Compile wlroots:
$ cd wlroots
$ meson setup build --prefix=/usr --buildtype=release -Dexamples=false
$ ninja -C build && make DESTDIR=$PKGDIR install

# 2. Compile Sway:
$ cd ../sway
$ meson setup build --prefix=/usr --buildtype=release -Dman-pages=disabled
$ ninja -C build && make DESTDIR=$PKGDIR install

Step 3: Default Configuration (/etc/sway/config)

Create a clean, functional default configuration for users:

# /etc/sway/config
# Mod4 = Super (Windows Key)
set $mod Mod4
set $term alacritty
set $menu wofi --show drun

# Set default wallpaper
output * bg /usr/share/backgrounds/byol-wallpaper.png fill

# Launch status bar
bar {
    swaybar_command waybar
}

# Keybindings
bindsym $mod+Return exec $term
bindsym $mod+d exec $menu
bindsym $mod+Shift+q kill
bindsym $mod+Shift+e exit

# Window splits
bindsym $mod+b splith
bindsym $mod+v splitv

With under 10 cleanly compiled packages, your custom distribution boots straight from cold iron into a hardware-accelerated, modern Wayland desktop environment!