█ █ ▄▀▀▄ █ █ █ █▀▀█ █▀▀█ █▀▀█
█ █ █ ████ █▄▄█ █ █ █ █ █ █▀▀
▀▄▀▄▀ █ █ ▄▄▄█ █▄▄█ █▄▄█ █▄▄█ █
Monolithic Wayland screenshot, persistent clipboard, and visual search utility in Rust
English · Русский · Architecture · Releases · Report Bug
Wayloop replaces fragile pipelines of grim, slurp, wl-copy, and shell scripts with a single hardened Rust binary (wayloop). Screen capture, persistent Wayland clipboard ownership, isolated background execution, and upcoming Circle to Search visual actions live inside one monolithic executable with zero idle VRAM overhead.
Status (
v1.0.1): Headless daemon, full-screenzwlr-screencopy-v1capture, atomic PNG saving, persistent Wayland clipboard, protected binary IPC, and D-Bus notifications are production-ready. Interactive CPU overlay selection, Google Lens, and Vision LLM/OCR are tracked in the Roadmap below.
Download a prebuilt release binary (x86_64 or aarch64), start the headless daemon, and capture your screen:
# 1. Download and install v1.0.1 (auto-detects x86_64 / aarch64)
VERSION="v1.0.1" ARCH="$(uname -m)"
curl -LO "https://github.com/Denxrc/wayloop/releases/download/${VERSION}/wayloop-${VERSION}-linux-${ARCH}.tar.gz"
curl -LO "https://github.com/Denxrc/wayloop/releases/download/${VERSION}/SHA256SUMS.txt"
sha256sum --ignore-missing -c SHA256SUMS.txt
tar -xzf "wayloop-${VERSION}-linux-${ARCH}.tar.gz"
install -Dm755 "wayloop-${VERSION}-linux-${ARCH}/wayloop" ~/.local/bin/wayloop
# 2. Start background daemon (add to compositor autostart)
wayloop daemon &
# 3. Capture full screen to persistent clipboard or disk
wayloop capture --mode full --action copy
wayloop capture --mode full --action save| Pillar | Implementation (v1.0.1) |
|---|---|
| Zero Idle VRAM | wayloop daemon runs completely headless without GPU or GUI initialization. |
| Native Capture | Direct zwlr-screencopy-v1 grab (overlay_cursor = 0), normalizing 6 wl_shm formats + y_invert into RGBA8 PNG. |
| Persistent Clipboard | Dedicated OS threads via wl-clipboard-rs (ext-data-control-v1 / zwlr-data-control-v1) with generation tracking so wayloop stop never hangs. |
| RAM-First & Atomic | Captures live in memory; explicit save sanitizes paths, writes 0600 temp files, calls sync_all(), atomically renames, and resolves collisions (_1, _2). |
| Hardened IPC | Single-instance flock, 0600 Unix socket with SO_PEERCRED UID check, pre-allocation frame limits (<= 50 MB), PNG magic validation, and 3s/5s/10s timeouts. |
| Memory-Safe & Bilingual | #![forbid(unsafe_code)], Clippy unwrap/expect/panic denies, localized EN/RU CLI & zbus D-Bus notifications. |
Wayland Compositor (Shortcuts: wayloop capture --mode full --action copy|save)
│
▼
┌────────────────────────────────────────┐
│ wayloop daemon │ Headless · 0 MB VRAM
│ · flock ($XDG_RUNTIME_DIR/wayloop.lock)
│ · 0600 Unix socket + SO_PEERCRED │
│ · ClipboardManager (wl-clipboard-rs) │◄─── SubmitCrop + PNG (full --action copy)
│ · tokio::spawn workers + zbus notify │◄─── CLI (status / stop / capture)
│ · OverlayManager (SIGTERM -> SIGKILL) │
└────────────────────────────────────────┘
┆
└─► [Planned Stage 3–5] wayloop __overlay (CPU SCTK + tiny-skia) · __result (LLM/OCR)
Deep dive into sequence diagrams, Wayland protocol edge cases, security invariants, workspace crates, and the extension playbook: ARCHITECTURE.md (Русский).
Workspace layout (crates & binary modules)
wayloop/
├── Cargo.toml # Workspace manifest, Clippy deny rules, panic = "abort"
├── src/
│ ├── main.rs # Bilingual CLI (daemon, capture, status, stop)
│ ├── daemon.rs # Headless daemon, flock, 0600 socket, SO_PEERCRED, binary IPC
│ ├── client.rs # Unix socket IPC transport (3s control / 10s binary PNG)
│ ├── notify.rs # Localized D-Bus notifications (zbus)
│ └── overlay_mgr.rs # Overlay child tracking & SIGTERM-to-SIGKILL grace toggle
└── crates/
├── wayloop-core/ # Config (TOML), geometry, atomic storage, i18n, IPC framing
├── wayloop-capture/ # CaptureBackend, zwlr-screencopy-v1, RGBA8 normalization, PNG
├── wayloop-clipboard/ # Persistent Wayland clipboard engine (wl-clipboard-rs)
├── wayloop-overlay/ # [Planned — Stage 3] CPU layer-shell overlay (SCTK + tiny-skia)
├── wayloop-providers/ # [Planned — Stage 4] ActionProvider, Google Lens, URL allowlist
└── wayloop-result/ # [Planned — Stage 5] Floating xdg-toplevel window
wayloop daemon # Start background daemon (use RUST_LOG=debug for verbose logs)
wayloop status # Inspect PID, uptime, overlay state, and clipboard status
wayloop capture --mode full --action copy # Capture primary wl_output to persistent Wayland clipboard
wayloop capture --mode full --action save # Capture primary wl_output atomically to disk (standalone)
wayloop stop # Gracefully stop the background daemonCLI help reference & forward-compatibility flags
- Interactive flags (
--mode rect,--mode lasso,--action lens,--action ai,--no-toolbar) are already parsed bywayloop captureand currently returnInteractive selection overlay is not implemented yet (use --mode full)until Stage 3–5.
Usage: wayloop <COMMAND>
Commands:
daemon Run background daemon
capture Trigger screen capture and overlay
status Check background daemon status
stop Stop background daemon
Capture Options (wayloop capture --help):
-m, --mode <MODE> Screen selection mode [possible values: rect, lasso, full]
-a, --action <ACTION> Target action on cropped area [possible values: copy, save, lens, ai]
--no-toolbar Hide toolbar capsule (instant capture with one gesture)
- Supported: Niri, Hyprland, Sway, River, and wlroots/Smithay compositors providing
zwlr-screencopy-v1andzwlr-data-control-v1/ext-data-control-v1(plus a D-Bus notification daemon such asmako,dunst, orswayncwhen built with default features). - Planned: GNOME / Mutter (
ashpdXDG Desktop Portal fallback) is scheduled for Stage 5.
Compositor keybindings & systemd user service (Hyprland, Niri, Sway, systemd)
exec-once = wayloop daemon
bind = , Print, exec, wayloop capture --mode full --action copy
bind = SUPER, Print, exec, wayloop capture --mode full --action save
# Planned (Stage 3–4):
# bind = SUPER SHIFT, S, exec, wayloop capture --mode lasso --action lens --no-toolbar
# bind = SUPER SHIFT, C, exec, wayloop capture --mode rect --action copy --no-toolbarspawn-at-startup "wayloop" "daemon"
binds {
Print { spawn "wayloop" "capture" "--mode" "full" "--action" "copy"; }
Mod+Print { spawn "wayloop" "capture" "--mode" "full" "--action" "save"; }
// Planned (Stage 3–4):
// Mod+Shift+S { spawn "wayloop" "capture" "--mode" "lasso" "--action" "lens" "--no-toolbar"; }
// Mod+Shift+C { spawn "wayloop" "capture" "--mode" "rect" "--action" "copy" "--no-toolbar"; }
}exec wayloop daemon
bindsym Print exec wayloop capture --mode full --action copy
bindsym $mod+Print exec wayloop capture --mode full --action save[Unit]
Description=Wayloop background clipboard and capture daemon
PartOf=graphical-session.target
After=graphical-session.target
[Service]
ExecStart=%h/.local/bin/wayloop daemon
Restart=on-failure
RestartSec=1
[Install]
WantedBy=graphical-session.targetsystemctl --user daemon-reload && systemctl --user enable --now wayloop.serviceReads $XDG_CONFIG_HOME/wayloop/config.toml or ~/.config/wayloop/config.toml (defaults apply when absent).
[general]
language = "auto" # "en" | "ru" | "auto"
[security]
max_ipc_payload_mb = 50 # Pre-allocation IPC limit (MB)
overlay_kill_grace_ms = 200 # Grace period before SIGKILL on overlay cancel
[storage]
save_dir = "~/Pictures/Screenshots"
filename_format = "wayloop_%Y-%m-%d_%H-%M-%S.png" # Formatted in UTC in v1.0.1
[notifications]
on_error = true
on_save = true
on_copy = falseFull config.toml schema (including Stage 3–5 reserved sections)
[general]
language = "auto" # Active: "en" | "ru" | "auto"
default_mode = "lasso" # Reserved (Stage 3): "rect" | "lasso" | "full"
default_action = "copy" # Reserved (Stage 3): "copy" | "save" | "lens" | "ai"
show_toolbar = true # Reserved (Stage 3)
scroll_switches_action = true # Reserved (Stage 3)
[security]
overlay_idle_timeout_secs = 90 # Reserved (Stage 3): overlay inactivity watchdog
overlay_kill_grace_ms = 200 # Active
max_ipc_payload_mb = 50 # Active
offline_only = false # Reserved (Stage 4): block all network providers
[toolbar] # Reserved (Stage 3)
position = "top-center" # Preset or { x = 640, y = 24 }
margin = 16
[selection] # Reserved (Stage 3)
min_selection_px = 8
lasso_padding = 4
dim_opacity = 0.42
stroke_width = 2.5
[theme] # Reserved (Stage 3 & 5)
background = "#181825E6"
accent = "#38BDF8FF"
foreground = "#F8FAFCFF"
corner_radius = 12
font_family = "Noto Sans"
[storage] # Active
save_dir = "~/Pictures/Screenshots"
filename_format = "wayloop_%Y-%m-%d_%H-%M-%S.png"
[providers.google_lens] # Reserved (Stage 4)
max_dimension = 1100
upload_format = "jpeg"
quality = 85
timeout_secs = 10
allowed_domains = ["lens.google.com", "www.google.com"]
[notifications] # Active
on_error = true
on_save = true
on_copy = false
[result_window] # Reserved (Stage 5)
backend = "toplevel" # "toplevel" | "layer_shell"
width = 460
height = 540Requires Linux (Wayland), Rust (edition = "2024", 1.85+), pkg-config, and Wayland headers (libwayland-dev / dev-libs/wayland).
git clone https://github.com/Denxrc/wayloop.git && cd wayloop
cargo build --release # Standard build (with zbus notifications)
cargo build --release --no-default-features # Minimal build without D-Bus notifications
install -Dm755 target/release/wayloop ~/.local/bin/wayloopContributor QA checks
cargo fmt --all --check
cargo clippy --workspace --all-targets -- -D warnings
cargo test --workspace --locked
cargo check --workspace --no-default-features --lockedRelease history (v0.5.0, v1.0.0, v1.0.1) is tracked on GitHub Releases.
- Stage 3 — CPU Overlay, Capsule & Watchdog (Next)
- Multi-output
zwlr-layer-shell-v1surfaces (smithay-client-toolkit+tiny-skia) - Dynamic toolbar capsule with clamping, scroll wheel action switching, and active-monitor tracking
- Freeform lasso & rectangular selection (
min_selection_px,lasso_padding,--no-toolbar) - 90s overlay inactivity watchdog & optional Linux
landlocksandboxing
- Multi-output
- Stage 4 — Google Lens & Network Security
-
ActionProvidertrait inwayloop-providerswithrequires_network()andoffline_only - Long-edge downscaling (~1100 px), EXIF stripping, and multipart POST via
rustls - Strict HTTPS + domain allowlist URL validation before browser launch
-
- Stage 5 — Result Window, Vision LLM & Local OCR
- Floating
xdg-toplevelwindow (wayloop-result) onicedoregui - Vision LLM SSE streaming (Gemini, OpenAI-compatible, Ollama) with
oo7/0600secret storage - Offline pure-Rust OCR (
ocrs) & XDG Desktop Portal fallback (ashpd) for GNOME/KDE
- Floating
MIT License · Crafted in Rust for Wayland · Architecture · Русская версия