Open Source › Lamco Wayland

Lamco Wayland

Rust libraries for Wayland screen capture, XDG Portal integration, and video processing

v0.4.4 meta-crate | MIT OR Apache-2.0 | Edition 2024, MSRV 1.85 | Wayland-only (no X11)
META-CRATE

One dependency, three capabilities

lamco-wayland is a meta-crate: add it to your Cargo.toml and select the subset you need via feature flags. All three member crates are independently publishable and usable, but most applications want two or three working together — portal negotiation gives you a PipeWire FD, PipeWire gives you frames, and video turns those frames into RDP-ready bitmaps.

These libraries exist because Wayland screen capture has no equivalent of X11's XShmGetImage. Capture on Wayland must go through a portal + PipeWire. The Rust ecosystem had incomplete bindings, unsafe FFI wrappers, and compositor-specific hacks. lamco-wayland is the unified, memory-safe, async-first alternative — the foundation under Lamco RDP Server.

ARCHITECTURE

How the pieces fit

┌─────────────────────────────────────────────────────────────────┐
│                        lamco-wayland                            │
├─────────────────┬─────────────────────┬─────────────────────────┤
│   lamco-portal  │   lamco-pipewire    │      lamco-video        │
│                 │                     │                         │
│  PortalManager  │  PipeWireManager    │  BitmapConverter        │
│  SessionHandle  │  VideoFrame         │  FrameProcessor         │
│  PortalConfig   │  PipeWireConfig     │  FrameDispatcher        │
└────────┬────────┴──────────┬──────────┴────────────┬────────────┘
         │                   │                       │
         ▼                   ▼                       ▼
   XDG Desktop Portal   PipeWire API            RDP Bitmap Format

Portal negotiates permission → PipeWire streams pixels → video processes frames into RDP bitmaps.

QUICK START

Add it. Request a session. Capture.

Cargo.toml
[dependencies]
lamco-wayland = "0.4"
tokio = { version = "1", features = ["full"] }
main.rs
use lamco_wayland::prelude::*;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Create portal manager
    let manager = PortalManager::with_default().await?;

    // Create session (triggers permission dialog on the compositor)
    let session = manager.create_session("my-session".to_string(), None).await?;

    // Access PipeWire FD and stream list for video capture
    let fd = session.pipewire_fd();
    let streams = session.streams();

    println!("Capturing {} streams on PipeWire FD {}", streams.len(), fd);

    Ok(())
}

Turn features on/off per crate: features = ["portal"] for portal only; features = ["full"] for every sub-crate feature.

USE CASES

Where it fits

  • RDP servers — Lamco RDP Server, custom implementations
  • VNC servers — Wayland-native VNC
  • Screen recording tools — capture Wayland displays
  • Video conferencing — screen sharing applications
  • Computer vision — process live Wayland content
  • Accessibility tools — screen readers, automation
REQUIREMENTS

What you need

  • A Wayland compositor (GNOME, KDE Plasma, Sway, Hyprland, …)
  • xdg-desktop-portal installed and running
  • A portal backend for your compositor
  • PipeWire (for pipewire / video features)
  • Rust 1.85 or newer (edition 2024)
  • X11 is not supported — Wayland only
COMPOSITOR SUPPORT

Tested across the Wayland ecosystem

Compositor Status Portal backend
GNOMETestedxdg-desktop-portal-gnome
KDE PlasmaTestedxdg-desktop-portal-kde
Sway / wlrootsTestedxdg-desktop-portal-wlr
HyprlandShould workxdg-desktop-portal-hyprland
Other WaylandMay workDepends on portal backend
X11Not supported

Build on lamco-wayland

Screen capture on Wayland shouldn't require reading the portal spec. Pull in the meta-crate, pick your features, and ship.