libwayshot
libwayshot is a convenient wrapper over the wlroots screenshot protocol that provides a simple API to take screenshots with.
Example usage
use WayshotConnection;
let wayshot_connection = new?;
let image_buffer = wayshot_connection.screenshot_all?;
Optional features
All features are enabled by default. To opt out selectively:
= { = "...", = false, = ["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 anEGLImageWayshotConnection::capture_target_frame_eglimage_on_display— capture to anEGLImageon a givenEGLDisplayWayshotConnection::bind_target_frame_to_gl_texture— capture and bind directly to the current GL textureWayshotConnection::create_screencast_with_egl— set up a screencast session with EGL display bindingEGLImageGuard— RAII wrapper that owns and destroys theEGLImageon drop