From ec9703e816928a8834862ec819f8cc2479f39453 Mon Sep 17 00:00:00 2001 From: Eduardo Date: Tue, 22 Sep 2026 19:58:32 -0300 Subject: [PATCH] fix(linux): resolve wayland protocol crash and disable webkit dmabuf renderer --- src-tauri/src/lib.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 05c7700..14bc3bf 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -37,8 +37,25 @@ fn ensure_sensible_path() { #[cfg(not(target_os = "macos"))] fn ensure_sensible_path() {} +#[cfg(target_os = "linux")] +fn ensure_linux_env() { + // Avoid Wayland protocol crash ("Error 71 dispatching to Wayland display") + // by falling back to X11/XWayland when GDK_BACKEND is not explicitly set. + if std::env::var_os("GDK_BACKEND").is_none() { + std::env::set_var("GDK_BACKEND", "x11"); + } + // Prevent WebKitGTK DMA-BUF rendering crashes and white/blank screens. + if std::env::var_os("WEBKIT_DISABLE_DMABUF_RENDERER").is_none() { + std::env::set_var("WEBKIT_DISABLE_DMABUF_RENDERER", "1"); + } +} + +#[cfg(not(target_os = "linux"))] +fn ensure_linux_env() {} + #[cfg_attr(mobile, tauri::mobile_entry_point)] pub fn run() { + ensure_linux_env(); ensure_sensible_path(); let state = build_state().expect("failed to initialize CodeLaunch state");