Skip to content

Commit 75a27e2

Browse files
fix(linux): move EGL/DMA-BUF workaround into Rust binary
The GitHub Actions workflow was patching the AppImage AppRun script to set WEBKIT_DISABLE_DMABUF_RENDERER=1, but that approach is fragile: appimagetool often fails in CI due to missing FUSE, and the env var may not propagate correctly to the webview process. Instead, set the variable directly in main.rs before Tauri starts. This works for AppImage, .deb, and .rpm alike, and users can still override it at launch with WEBKIT_DISABLE_DMABUF_RENDERER=0. Also bump version to 0.9.5. Refs: EGL_BAD_PARAMETER crash on AppImage launch
1 parent 5cfd749 commit 75a27e2

5 files changed

Lines changed: 21 additions & 35 deletions

File tree

.github/workflows/release.yml

Lines changed: 6 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -112,35 +112,9 @@ jobs:
112112
prerelease: false
113113
args: ${{ matrix.args }}
114114

115-
# Bake `WEBKIT_DISABLE_DMABUF_RENDERER=1` into the AppImage's AppRun
116-
# so users on configs that mismatch the runner's EGL stack (NVIDIA
117-
# proprietary, Hyprland, some Wayland compositors) don't crash at
118-
# launch with `Could not create default EGL display`. The fallback
119-
# variable form (`${VAR:-1}`) lets a user reactivate the DMA-BUF
120-
# renderer with `WEBKIT_DISABLE_DMABUF_RENDERER=0 ./app.AppImage`
121-
# if it works on their machine.
122-
#
123-
# `tauri-action` already uploaded the original (unpatched) AppImage
124-
# to the draft release in the previous step, so this step rebuilds
125-
# the AppImage with the patched AppRun and overwrites the release
126-
# asset via `gh release upload --clobber`. Net effect: the asset
127-
# users download is the patched one.
128-
- name: Patch AppImage with EGL workaround
129-
if: matrix.platform == 'ubuntu-24.04'
130-
shell: bash
131-
env:
132-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
133-
run: |
134-
set -euo pipefail
135-
cd src-tauri/target/release/bundle/appimage
136-
APPIMAGE=$(ls *.AppImage | head -n 1)
137-
./"$APPIMAGE" --appimage-extract >/dev/null
138-
# Insert the env var on line 2 (right after the shebang) so the
139-
# webview process inherits it before WebKitGTK initializes.
140-
sed -i '2i export WEBKIT_DISABLE_DMABUF_RENDERER=${WEBKIT_DISABLE_DMABUF_RENDERER:-1}' squashfs-root/AppRun
141-
wget -q -O appimagetool https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage
142-
chmod +x appimagetool
143-
ARCH=x86_64 ./appimagetool squashfs-root "$APPIMAGE"
144-
rm -rf squashfs-root appimagetool
145-
# Overwrite the draft release's AppImage with the patched build.
146-
gh release upload "${{ github.ref_name }}" "$APPIMAGE" --clobber --repo "${{ github.repository }}"
115+
# The EGL/DMA-BUF workaround now lives in src-tauri/src/main.rs:
116+
# `std::env::set_var("WEBKIT_DISABLE_DMABUF_RENDERER", "1")` on Linux
117+
# before Tauri starts. This is more reliable than patching the AppRun
118+
# script because it works for .deb / .rpm / AppImage alike and survives
119+
# any bundler changes. Users can still override it at launch:
120+
# WEBKIT_DISABLE_DMABUF_RENDERER=0 ./app.AppImage

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "courvux-tauri-notepad",
33
"private": true,
4-
"version": "0.9.4",
4+
"version": "0.9.5",
55
"description": "Notepad demo app — Courvux + Tauri 2 + Tailwind 4 with build-time precompiled expressions and strict CSP (script-src 'self', no unsafe-eval).",
66
"type": "module",
77
"scripts": {

src-tauri/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "courvux-tauri-notepad"
3-
version = "0.9.4"
3+
version = "0.9.5"
44
edition = "2021"
55
authors = ["Vanjex <vanjexdev@gmail.com>"]
66
license = "MIT"

src-tauri/src/main.rs

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

44
fn main() {
5+
// WebKitGTK 2.44+ (empaquetado desde ubuntu-24.04) activa DMA-BUF/EGL por
6+
// defecto, pero el stack gráfico del usuario (NVIDIA propietario, algunos
7+
// compositores Wayland, o configuraciones sin aceleración) falla con
8+
// "Could not create default EGL display: EGL_BAD_PARAMETER". Desactivar
9+
// el renderer DMA-BUF antes de que WebKit se inicialice evita el crash y
10+
// la pantalla en blanco. El usuario puede reactivarlo con
11+
// WEBKIT_DISABLE_DMABUF_RENDERER=0 ./app.AppImage si su stack funciona.
12+
#[cfg(target_os = "linux")]
13+
if std::env::var("WEBKIT_DISABLE_DMABUF_RENDERER").is_err() {
14+
std::env::set_var("WEBKIT_DISABLE_DMABUF_RENDERER", "1");
15+
}
16+
517
courvux_tauri_notepad_lib::run()
618
}

src-tauri/tauri.conf.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "https://schema.tauri.app/config/2",
33
"productName": "Courvux Notepad",
4-
"version": "0.9.4",
4+
"version": "0.9.5",
55
"identifier": "dev.vanjex.courvux-tauri-notepad",
66
"build": {
77
"beforeDevCommand": "pnpm dev",

0 commit comments

Comments
 (0)