issue 2021: harden Linux WebKit rendering (fixes black AppImage window)
Desktop (Tauri) / Tauri desktop (Linux) (push) Successful in 3m12s
Desktop (Tauri) / Tauri desktop (Linux) (push) Successful in 3m12s
WebKitGTK's DMA-BUF/EGL renderer fails to init on many Linux GPU/driver/Wayland setups -> 'EGL_BAD_PARAMETER' -> black window (known WebKitGTK issue, not app code). Per Tauri's Linux-graphics guidance, set the software-fallback env vars at startup before the webview is created, scoped to AppImage launches (native installs keep GPU accel): __NV_DISABLE_EXPLICIT_SYNC / WEBKIT_DISABLE_DMABUF_RENDERER / WEBKIT_DISABLE_COMPOSITING_MODE, each only if the user already set it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FRgehjoz7Yv8LkUfADxACm
This commit is contained in:
@@ -10,6 +10,9 @@ mod integration;
|
||||
|
||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||
pub fn run() {
|
||||
#[cfg(target_os = "linux")]
|
||||
harden_linux_webkit_rendering();
|
||||
|
||||
tauri::Builder::default()
|
||||
.invoke_handler(tauri::generate_handler![
|
||||
integration::integration_status,
|
||||
@@ -19,3 +22,33 @@ pub fn run() {
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running the ThoughtSync desktop app");
|
||||
}
|
||||
|
||||
/// WebKitGTK's GPU-accelerated rendering (the DMA-BUF renderer + EGL compositing) fails
|
||||
/// to initialize on a wide range of Linux GPU/driver/Wayland setups — "Could not create
|
||||
/// default EGL display: EGL_BAD_PARAMETER" → a black/blank window. This is a well-known
|
||||
/// WebKitGTK issue that hits Tauri apps broadly, NOT app-specific. Tauri's guidance
|
||||
/// (https://v2.tauri.app/develop/debug/linux-graphics/) is to force the software
|
||||
/// fallbacks at startup, before the webview is created, so end users don't have to.
|
||||
///
|
||||
/// We apply the fix ONLY for AppImage launches (where these failures cluster and where
|
||||
/// bundled libs are in play), leaving each var overridable — native (.deb) installs use
|
||||
/// system libs and keep GPU acceleration untouched. WebKit software rendering is plenty
|
||||
/// for this UI.
|
||||
#[cfg(target_os = "linux")]
|
||||
fn harden_linux_webkit_rendering() {
|
||||
let is_appimage =
|
||||
std::env::var_os("APPIMAGE").is_some() || std::env::var_os("APPDIR").is_some();
|
||||
if !is_appimage {
|
||||
return;
|
||||
}
|
||||
// Ordered per Tauri's escalation ladder; each set only if the user hasn't chosen.
|
||||
for (key, value) in [
|
||||
("__NV_DISABLE_EXPLICIT_SYNC", "1"),
|
||||
("WEBKIT_DISABLE_DMABUF_RENDERER", "1"),
|
||||
("WEBKIT_DISABLE_COMPOSITING_MODE", "1"),
|
||||
] {
|
||||
if std::env::var_os(key).is_none() {
|
||||
std::env::set_var(key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user