libwayshot 0.8.0

Screenshot crate for wlroots based compositors implementing the zwlr_screencopy_v1 protocol.
Documentation

libwayshot

libwayshot is a convenient wrapper over the wlroots screenshot protocol that provides a simple API to take screenshots with.

Example usage

use libwayshot::WayshotConnection;

let wayshot_connection = WayshotConnection::new()?;
let image_buffer = wayshot_connection.screenshot_all()?;

Optional features

All features are enabled by default. To opt out selectively:

libwayshot = { version = "...", default-features = false, features = ["png", "egl"] }
Feature What it enables Extra dependencies
png PNG encoding/decoding — (via image)
jpeg JPEG encoding/decoding — (via image)
qoi QOI encoding/decoding — (via image)
webp WebP encoding/decoding — (via image)
avif AVIF encoding/decoding rav1e (via image)
egl EGL/OpenGL GPU capture backend (DMA-BUF → EGLImage → GL texture) gl, r-egl-wayland

EGL capture backend

The egl feature enables zero-copy GPU screen capture via the EGL/OpenGL path. When enabled, the following APIs are available:

  • WayshotConnection::capture_target_frame_eglimage — capture to an EGLImage
  • WayshotConnection::capture_target_frame_eglimage_on_display — capture to an EGLImage on a given EGLDisplay
  • WayshotConnection::bind_target_frame_to_gl_texture — capture and bind directly to the current GL texture
  • WayshotConnection::create_screencast_with_egl — set up a screencast session with EGL display binding
  • EGLImageGuard — RAII wrapper that owns and destroys the EGLImage on drop