tonhowtf/omniget · error

sessao Wayland sem XWayland: o x11grab nao enxerga a tela…

Error message

sessao Wayland sem XWayland: o x11grab nao enxerga a tela. Use a captura do OmniDisc (PipeWire) ou entre numa sessao X11.

What it means

On Linux, screen_record::start() uses ffmpeg's x11grab, which cannot see a pure Wayland session. If WAYLAND_DISPLAY is set and DISPLAY is not (no XWayland), start() fails immediately with this guidance to use PipeWire capture or an X11 session.

Solutions

  1. Install/enable XWayland so DISPLAY is set (e.g. install xorg-x11-server-Xwayland)
  2. Log into an X11 session instead of Wayland
  3. Use the OmniDisc (PipeWire) capture path for Wayland instead of this x11grab tool
  4. Check env: echo $DISPLAY must be non-empty for x11grab to work

Example fix

// before (Wayland-only session)
start(opts).await?; // errors
// after
if std::env::var("WAYLAND_DISPLAY").is_ok() && std::env::var("DISPLAY").is_err() {
    // route to PipeWire-based capture instead
    start_pipewire(opts).await?;
} else {
    start(opts).await?;
}
Defensive patterns

Strategy: validation

Validate before calling

if cfg!(target_os = "linux")
    && std::env::var("WAYLAND_DISPLAY").is_ok()
    && std::env::var("DISPLAY").is_err()
{
    eprintln!("Wayland without XWayland: use PipeWire capture or an X11 session");
}

Try / catch

match screen_record::start(opts).await {
    Err(e) if e.to_string().contains("Wayland sem XWayland") => {
        // fall back to PipeWire-based capture
        start_pipewire_capture(opts).await
    }
    other => other,
}

Prevention

When it happens

Trigger: Calling start() on Linux while running a Wayland session (e.g. GNOME Wayland, KDE Wayland) without XWayland installed or without DISPLAY set.

Common situations: Minimal Wayland setups without xwayland package; running inside a sandbox/container that hides DISPLAY; newer distro defaults shipping Wayland-only sessions.

Understand the failure class

Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.

Related errors


AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12). Data as JSON: /api/errors/7e467ade7cdcb7f2. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/screen_record.rs:340

            "-segment_format_options".into(),
            "movflags=+faststart".into(),
        ]);
        a.push(target.join("seg-%03d.mp4").to_string_lossy().to_string());
    } else {
        a.push(target.to_string_lossy().to_string());
    }
    a
}

pub async fn start(opts: RecordOptions) -> anyhow::Result<RecordState> {
    if SESSION.lock().unwrap_or_else(|e| e.into_inner()).is_some() {
        return Err(anyhow!("ja esta gravando"));
    }
    if cfg!(target_os = "linux")
        && std::env::var("WAYLAND_DISPLAY").is_ok()
        && std::env::var("DISPLAY").is_err()
    {
        return Err(anyhow!("sessao Wayland sem XWayland: o x11grab nao enxerga a tela. Use a captura do OmniDisc (PipeWire) ou entre numa sessao X11."));
    }
    let ffmpeg = crate::core::dependencies::ensure_ffmpeg().await?;
    let dir = if opts.output_dir.trim().is_empty() {
        videos_dir()
    } else {
        PathBuf::from(opts.output_dir.trim())
    };
    std::fs::create_dir_all(&dir)?;
    let ring = opts.replay_seconds > 0;
    let (target, ring_dir, output) = if ring {
        let r = super::temp_dir().join(format!("replay-{}", uuid::Uuid::new_v4()));
        std::fs::create_dir_all(&r)?;
        (r.clone(), Some(r), None)
    } else {
        let out = dir.join(format!("Gravacao {}.mp4", stamp()));
        (out.clone(), None, Some(out))
    };
    let args = build_args(&opts, &target, ring);

View on GitHub (pinned to 8600b91f42)