Skip to content

Commit be8b1ee

Browse files
doublegateclaude
andcommitted
fix(wraith-recon): add Wayland compatibility workarounds for KDE Plasma 6
- Add X11 fallback for Wayland sessions on KDE Plasma - Disable WebKitGTK compositing mode to prevent GBM buffer errors - Fixes "Error 71 (Protocol error) dispatching to Wayland display" crash - Same fix as applied to other Tauri clients (wraith-transfer, etc.) See: tauri-apps/tauri#10702 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent d59d4de commit be8b1ee

File tree

2 files changed

+78
-0
lines changed

2 files changed

+78
-0
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,14 @@ This release introduces **WRAITH-Recon**, a Tier 3 network reconnaissance and da
7373
- Total test count increased to ~2,203 tests across all crates and clients
7474
- Updated release workflow to include WRAITH-Recon in CI/CD builds
7575

76+
### Fixed
77+
78+
- **WRAITH-Recon Wayland compatibility**: Added X11 fallback and GBM workarounds for KDE Plasma 6
79+
- Fixes "Error 71 (Protocol error) dispatching to Wayland display" crash on launch
80+
- Automatic detection of KDE Plasma sessions and graceful fallback to X11 via XWayland
81+
- Disabled WebKitGTK compositing mode to prevent GBM buffer allocation failures
82+
- See: https://github.com/tauri-apps/tauri/issues/10702
83+
7684
### Security
7785

7886
- WRAITH-Recon includes comprehensive safety controls for authorized testing only

clients/wraith-recon/src-tauri/src/main.rs

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,75 @@
22
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
33

44
fn main() {
5+
// Workaround for Wayland Error 71 (Protocol error) on KDE Plasma 6
6+
// See: https://github.com/tauri-apps/tauri/issues/10702
7+
// https://github.com/tauri-apps/tao/issues/977
8+
//
9+
// WebKitGTK has compatibility issues with Wayland on KDE Plasma 6, causing
10+
// "Error 71 (Protocol error) dispatching to Wayland display" crashes.
11+
// This is an upstream issue blocked by tao/webkit2gtk compatibility.
12+
//
13+
// Solution: Automatically fallback to X11 via XWayland if:
14+
// 1. We're on Linux
15+
// 2. GDK_BACKEND is not already set (respect user preference)
16+
// 3. We're in a Wayland session
17+
// 4. We're on KDE Plasma 6 (or any Wayland compositor with issues)
18+
#[cfg(target_os = "linux")]
19+
{
20+
use std::env;
21+
22+
// Only set GDK_BACKEND if not already configured by user
23+
if env::var("GDK_BACKEND").is_err() {
24+
// Check if we're in a Wayland session
25+
if let Ok(session_type) = env::var("XDG_SESSION_TYPE") {
26+
if session_type == "wayland" {
27+
// Check for KDE Plasma (common source of Error 71)
28+
let is_kde = env::var("KDE_SESSION_VERSION").is_ok()
29+
|| env::var("KDE_FULL_SESSION").is_ok()
30+
|| env::var("DESKTOP_SESSION")
31+
.map(|s| s.contains("plasma") || s.contains("kde"))
32+
.unwrap_or(false);
33+
34+
if is_kde {
35+
eprintln!(
36+
"Detected KDE Plasma on Wayland - forcing X11 backend to avoid Error 71"
37+
);
38+
eprintln!("See: https://github.com/tauri-apps/tauri/issues/10702");
39+
// SAFETY: We're in main() before any threads are spawned,
40+
// so there's no risk of data races with other threads reading env vars
41+
unsafe {
42+
env::set_var("GDK_BACKEND", "x11");
43+
}
44+
} else {
45+
// For other Wayland compositors, prefer Wayland but fallback to X11
46+
// This allows GDK to try Wayland first, then X11 if issues occur
47+
// SAFETY: We're in main() before any threads are spawned,
48+
// so there's no risk of data races with other threads reading env vars
49+
unsafe {
50+
env::set_var("GDK_BACKEND", "wayland,x11");
51+
}
52+
}
53+
}
54+
}
55+
}
56+
57+
// Workaround for GBM (Generic Buffer Management) errors
58+
// See: https://github.com/tauri-apps/tauri/issues/13493
59+
// https://github.com/winfunc/opcode/issues/26
60+
//
61+
// WebKitGTK's hardware-accelerated compositing can fail with:
62+
// "Failed to create GBM buffer of size WxH: Invalid argument"
63+
//
64+
// This occurs due to incompatibility between WebKitGTK, Mesa, and GPU drivers
65+
// (especially NVIDIA). Disabling compositing mode forces WebKit to use a
66+
// simpler, more compatible rendering path.
67+
if env::var("WEBKIT_DISABLE_COMPOSITING_MODE").is_err() {
68+
// SAFETY: We're in main() before any threads are spawned
69+
unsafe {
70+
env::set_var("WEBKIT_DISABLE_COMPOSITING_MODE", "1");
71+
}
72+
}
73+
}
74+
575
wraith_recon_lib::run()
676
}

0 commit comments

Comments
 (0)