Skip to content

Getting Started ​

Viewport is a Wayland compositor written in Rust whose entire shell — wallpaper, status bar, window frames, titlebars, launcher, lock screen and settings panel — is a web page, composited zero-copy alongside native Wayland and XWayland clients.

Smithay handles DRM/KMS, input and Wayland protocols. viewport-vulkan drives GPU compositing with HDR, real-time background blur and cross-GPU shadow buffers (with a GLES fallback). A browser engine renders the shell to a DMA-BUF. Neither ever hands a pixel to the CPU.

        ┌───────────────────────────────────────────────────┐
        │  shell (HTML/CSS/JS, loaded from a URL)           │
        └──────────────────┬────────────────────────────────┘
                           │  DMA-BUF (Wayland client / WPE)  ▲ JSON over IPC
                           ▼                                  │ (Unix socket / WPE)
        ┌─────────────────────────────────────────────────────┴───┐
        │  viewport (Rust · Smithay · viewport-vulkan / GLES)     │
        │    shell layer      ← web shell DMA-BUF                 │
        │    Space            ← native Wayland & XWayland clients │
        │    shell.overlay    ← glass bar, menus, dialogs, OSK    │
        └──────────────────┬──────────────────────────────────────┘
                           ▼  DrmOutput / atomic KMS commit
                        DRM/KMS

Quick Start ​

Run Viewport directly from the Nix flake without compiling a browser engine:

sh
nix run github:codebam/viewport

It nests inside your existing Wayland/X11 session when one is running, and takes the DRM device directly on a TTY when there is not. Press Mod4+Shift+e to quit, or pass -- --exit-after 30 to set an automatic timeout.

Control a running session ​

The same binary is the client for its own control socket:

sh
viewport msg -t view.focus --id 12
viewport msg -t output.query --pretty
viewport msg -t subscribe view.focused    # follow events until ^C
viewport msg -t quit                      # from a second TTY, if needed
viewport msg --help                       # every message and its fields

Every message in IPC and writing a shell can be sent this way under its wire name.

Installing ​

NixOS ​

flake.nix provides packages, dev shells and NixOS / Home Manager modules. Set programs.viewport.shellBackend to choose which browser engine draws the shell:

nix
programs.viewport = {
  enable = true;
  shellBackend = "chromium";   # the default; also "webkitgtk", "cef",
                               # "wpe" or "servoshell"
};
  • programs.viewport.chromiumBinary names the browser the chromium backend drives (nixpkgs' chromium by default, or any Chromium-family browser by path).
  • userConfig = true leaves configuration to ~/.config/viewport/config.json instead of generating one from module options (useful with Home Manager's xdg.configFile).

Arch Linux / CachyOS ​

packaging/aur/ contains six PKGBUILDs across three engines (viewport-wpe, viewport-webkitgtk, viewport-chromium), each with a release and -git variant. Because wpewebkit with the WPE Platform API is already packaged on Arch, each builds in about a minute:

sh
cd packaging/aur/viewport-wpe && makepkg -si

All variants install the viewport binary and register a wayland-sessions entry so display managers offer Viewport at login.

Building with Nix ​

sh
nix build github:codebam/viewport        # default — chromium
nix build github:codebam/viewport#chromium
nix build github:codebam/viewport#webkitgtk
nix build github:codebam/viewport#cef
nix build github:codebam/viewport#servoshell
nix build github:codebam/viewport#wpe    # in-process; builds WPE WebKit from source

See Shell backends and Benchmarks to compare engine CPU, memory and frame pacing trade-offs.

Developing in the Tree ​

sh
nix develop .#rust   # Rust toolchain + test suite dependencies
cargo test --workspace
cargo build --bin viewport --bin viewport-shell-gtk
scripts/integration.sh target/debug/viewport   # real Wayland clients, headless

Run nested against a shell you are actively editing:

sh
cargo run --bin viewport -- --url http://localhost:3000

Use --url-span on multi-monitor setups to span your development shell across every output instead of only the first screen. See Configuration and keybindings for all flags.

Workspace Layout ​

CrateLicenceRole
crates/viewportGPL-3.0-or-laterMain Wayland/XWayland compositor binary (viewport) and IPC CLI (viewport msg)
crates/viewport-ipcMITWire protocol types, framing and CLI schema shared across compositor, CLI and shell bridges
crates/viewport-shell-bridgeMITShared out-of-process shell host and Chrome DevTools Protocol session logic
crates/viewport-webMITIn-process WPE WebKit FFI shim (enabled with --features wpe)
crates/viewport-shell-chromiumMITDefault shell backend driving system Chromium over CDP
crates/viewport-shell-gtkMITOut-of-process WebKitGTK shell backend
crates/viewport-shell-servoshellMITOut-of-process Servo shell backend driving servoshell
crates/viewport-shell-cefMITOut-of-process embedded Blink shell backend via CEF (standalone workspace; requires CEF_PATH)
crates/viewport-shell-servoMITOut-of-process embedded Servo shell backend (standalone workspace; compiles servo from source)
viewport-vulkanMITStandalone Smithay Vulkan renderer with HDR, blur, ICC colour management and explicit sync

Next Steps ​

Compositor licensed under GPL-3.0-or-later · Protocol, shell, bridges and renderer licensed under MIT.