From 72c2afb1a4cc41ff3f844bfbfb7464efbc51998a Mon Sep 17 00:00:00 2001 From: Haapy Date: Thu, 14 May 2026 23:31:53 +0000 Subject: [PATCH] fix error --- src-tauri/src/lib.rs | 9 +++++++++ src-tauri/src/x11mod.rs | 9 ++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 980cd72..8b9c677 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -8,6 +8,15 @@ use x11mod::{ #[cfg_attr(mobile, tauri::mobile_entry_point)] pub fn run() { + // X11 reparenting requires our own window to be an X11 window. On Wayland + // sessions, GTK defaults to the Wayland backend and embedding is impossible. + // Force the X11 backend (via XWayland on Wayland sessions) so we always get + // an X11 toplevel we can reparent into. + #[cfg(target_os = "linux")] + { + std::env::set_var("GDK_BACKEND", "x11"); + } + tauri::Builder::default() .manage(PtyState::default()) .manage(X11State::new()) diff --git a/src-tauri/src/x11mod.rs b/src-tauri/src/x11mod.rs index b66bcf4..646cb99 100644 --- a/src-tauri/src/x11mod.rs +++ b/src-tauri/src/x11mod.rs @@ -104,9 +104,12 @@ fn fetch_tauri_xid(app: &AppHandle, window: tauri::WebviewWindow) -> Result