| Crates.io | wlgif |
| lib.rs | wlgif |
| version | 0.2.0 |
| created_at | 2025-12-30 03:02:19.739956+00 |
| updated_at | 2026-01-04 04:27:57.96234+00 |
| description | Lightweight screen recorder for Wayland that captures regions as GIFs |
| homepage | https://github.com/doprz/wlgif |
| repository | https://github.com/doprz/wlgif |
| max_upload_size | |
| id | 2011947 |
| size | 90,796 |
Lightweight screen recorder for Wayland that captures regions as GIFs
Screen-to-GIF on Wayland has historically been painful. wlgif solves this with a simple, seamless workflow: select a region, record, and get a GIF. No configuration, no complexity.
wlgif supports two recording backends:
| Backend | Compositors | How it works |
|---|---|---|
| portal | Any (GNOME, KDE, etc...) | XDG Desktop Portal + PipeWire + GStreamer |
| wlr | wlroots-based (Sway, Hyprland, etc...) | slurp + wf-recorder + ffmpeg |
The backend is auto-detected, preferring portal for broader compatibility. Use --backend to override.
wlgif follows core Unix principles:
What this means for features: We welcome additions that make screen-to-GIF better. What we won't become: an image editor, video editor, or general-purpose media tool.
Contributions are welcome! See CONTRIBUTING.md for guidelines and HACKING.md for development.
cargo install wlgif
wlgif is available as a nix flake via GitHub
# From GitHub
nix run github:doprz/wlgif
To build and install from source, first checkout the tag or branch you want to install, then run
cargo install --path .
This will build and install wlgif in your ~/.cargo/bin. Make sure that ~/.cargo/bin is in your $PATH variable.
Works on any Wayland compositor with portal support.
| Dependency | Purpose |
|---|---|
| xdg-desktop-portal | Screen capture API |
| pipewire | Media streaming |
| gstreamer | Video encoding |
| ffmpeg | GIF encoding |
For wlroots-based compositors (Sway, Hyprland, Niri, dwl, etc.)
| Dependency | Purpose |
|---|---|
| slurp | Region selection |
| wf-recorder | Screen capture |
| ffmpeg | GIF encoding |
Usage: wlgif [OPTIONS]
Options:
-b, --backend <NAME> Recording backend (auto-detected if not specified)
-o, --output <OUTPUT> Output GIF file path [default: output.gif]
-d, --duration <SECS> Recording duration in seconds (0 = manual stop with Ctrl+C) [default: 5]
-f, --fps <FPS> Frames per second (10-30 recommended) [default: 15]
-g, --geometry <WxH+X+Y> Region geometry, skip interactive selection (WxH+X+Y)
-w, --width <PX> Scale output width in pixels (height auto-calculated)
--fast Skip palette optimization (faster, larger file)
--keep-video Keep intermediate video file
-q, --quiet Suppress status output
-h, --help Print help
-V, --version Print version
Examples:
wlgif output.gif Select region, record for 5s
wlgif -d 10 output.gif Record for 10 seconds
wlgif -d 0 output.gif Manual stop with Ctrl+C
wlgif -g 800x600+100+100 out.gif Skip selection, use geometry
wlgif --fps 30 -w 640 output.gif 30fps, scaled to 640px wide
wlgif --backend xdg output.gif Use XDG portal (cross-compositor)
Dependencies:
portal: xdg-desktop-portal, pipewire, gstreamer
wlr: slurp, wf-recorder, ffmpeg
# Basic: select region interactively, record 5 seconds
wlgif output.gif
# Record for 10 seconds
wlgif -d 10 output.gif
# Record until Ctrl+C
wlgif -d 0 output.gif
# Skip interactive selection, specify geometry directly
wlgif -g 800x600+100+100 output.gif
# Higher framerate (smoother, larger file)
wlgif --fps 30 output.gif
# Scale output width (maintains aspect ratio)
wlgif -w 640 output.gif
# Fast mode: skip optimization (quicker, larger file)
wlgif --fast output.gif
# Quiet mode: no status output
wlgif -q output.gif
# Keep the intermediate video file
wlgif --keep-video output.gif
# Use XDG portal backend (WIP feature)
wlgif --backend xdg output.gif
| Goal | Command |
|---|---|
| Smaller files | wlgif -w 480 --fps 10 out.gif |
| Higher quality | wlgif --fps 30 out.gif |
| Quick capture | wlgif --fast out.gif |
| Scripting | wlgif -q -g 800x600+0+0 out.gif |
slurp draws a selection overlaywf-recorder records via wlroots screencopy protocolThe two-pass encoding is why wlgif produces smaller, better-looking GIFs than naive single-pass conversion.
SPDX-License-Identifier: MIT
Licensed under the MIT License. See LICENSE for full details.