Expand description
wlr-capture — the reusable bricks behind the wlr-utils tools.
Always available (headless-friendly, no egui/EGL display deps):
wl: native Wayland client that enumerates foreign toplevels + outputs and captures them (full-resolution, zero-copy GPU dma-buf path) viaext-image-copy-capture.clipboard: put a captured blob on the wlroots clipboard (data-control).gl: EGL/GL dma-buf import + headless readback (gl::GpuReadback).sink: thesink::FrameSinkseam shared by screenshot/record/timelapse, with GPU dma-buf readback under the default path.stream: the shared live-capture session driver (arm/poll/reopen/give-up), used by the mirror, recorder and change monitor.diff: a frame-difference metric for change detection.
Behind the compose feature (resamples with image):
capture: resolve a source (output/window/region) to awl::CapturedImage, compositing across mixed-scale outputs. Shared bywlr-shotandwlr-peek.
Behind the video feature (links system FFmpeg via ffmpeg-next, headless):
video: asink::FrameSinkthat encodes a capture stream to a file with a pluggable hardware/software backend (NVENC / VAAPI / libx264).
Behind the focus feature (compositor IPC, pulls serde_json):
focus: “the active window” / “the current output” via the compositor’s own IPC (Sway today). Wayland gives no portable way to query focus.
Always available — UI text via the tr! macro:
i18n: localisation. With thei18nfeature (default) it uses Fluent; without it,tr!returns the English text generated from theencatalog at build time, pulling no Fluent dependency. So every module (core or toolkit) can calltr!.
Behind the toolkit feature (on by default) — the egui/EGL overlay toolkit:
render: egui →egui_glowrendering on an EGL context bound to a surface.icons/theme: shared overlay UI helpers.
Consumers (wlr-chooser, wlr-pip, …) build their own windowing host on top
and reuse this engine for the heavy lifting; a future headless recorder can use
the capture engine + readback without pulling in the toolkit.
Modules§
- capture
compose - High-level capture: resolve a source (output, window, logical region) to a
ready-to-use
CapturedImage, compositing across outputs when a region spans several (possibly mixed-scale) monitors. - clipboard
- Native Wayland clipboard copy via
zwlr_data_control_v1(the wlroots clipboard-manager protocol, the same onewl-copyandgrimuse). - diff
- Frame-difference metric for change detection.
- focus
focus - Focus-aware capture helpers: “the active window” and “the current output”.
- gl
- EGL/GLES core: dma-buf → GL texture import and headless readback.
- i18n
- Internationalisation.
- icons
toolkit - Resolve an application icon from its app-id and rasterize it to RGBA8
(unmultiplied alpha), for display next to window names. PNG/JPEG via
image, SVG viaresvg. - mirror
mirror - xdg-toplevel windowing host for the live mirror.
- overlay
overlay - Interactive frozen-screen overlay: a
wlr-layer-shellsurface per output showing that output’s frozen capture, shared by several interactions (Mode):select_region(drag a rectangle),pick_point(thewlr-peekcolour picker, with a loupe) andmagnify(a full-screen zoom that follows the cursor). Coordinates are tracked in the global logical space so they span outputs. Rendered with egui on the sharedrender::Gpu, like the chooser’s overlay — one surface (and GL context) per output. - render
toolkit - Shared egui →
egui_glowrendering core on an EGL/GLES context bound to a Wayland surface, plus zero-copy dma-buf → GL texture import. - sink
- Common output seam for capture-consuming tools (screenshot, record, timelapse).
- stream
- Shared driver for a live capture session over one source.
- theme
toolkit - Colour & font theme. Sensible generic-dark defaults, overridable from
~/.config/wlr-chooser/theme.toml(or$XDG_CONFIG_HOME/wlr-chooser/theme.toml). - video
video - Video encoding sink: turn a capture stream into a file via FFmpeg.
- wl
- Native Wayland client: enumerate foreign toplevels and outputs, and capture
them via
ext-image-copy-capture-v1.
Macros§
- tr
i18n - Look up a UI message, optionally with
name = valuearguments.
Structs§
- Connection
- The Wayland connection