Skip to content

Commit b83ce20

Browse files
committed
Enhance Tauri build process for Linux by adding environment variable configurations
- Updated the GitHub Actions workflow to verify the existence of the standalone binary and fallback to a standard build if not found, improving build reliability. - Added environment variable settings in the Rust code to address rendering issues on Linux, specifically targeting WebKit configurations to prevent EGL errors and improve stability. These changes enhance the build process and ensure better performance of the Tauri application on Linux systems.
1 parent 8f4c64d commit b83ce20

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

.github/workflows/release.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,14 @@ jobs:
123123

124124
- name: Build Tauri app
125125
working-directory: frontend
126-
run: bunx tauri build --bundles deb,rpm,appimage
126+
run: |
127+
# Build bundles (this also builds the standalone binary)
128+
bunx tauri build --bundles deb,rpm,appimage
129+
# Verify the standalone binary exists
130+
if [ ! -f "src-tauri/target/release/budget-planer" ]; then
131+
echo "::error::Standalone binary not found, building without bundles..."
132+
bunx tauri build
133+
fi
127134
# Optional: Set these secrets in GitHub Settings → Secrets for code signing
128135
# If not set, Tauri will build without signing (linter warnings are expected)
129136
env:

frontend/src-tauri/src/lib.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -887,6 +887,32 @@ fn start_backend_server(
887887

888888
#[cfg_attr(mobile, tauri::mobile_entry_point)]
889889
pub fn run() {
890+
// Fix grey window issue on Linux by setting WebKit environment variables
891+
// This disables problematic rendering features that cause EGL errors
892+
#[cfg(target_os = "linux")]
893+
{
894+
use std::env;
895+
// Disable DMABUF renderer to fix EGL_BAD_PARAMETER errors
896+
// Safety: Setting environment variables is safe in single-threaded context before Tauri starts
897+
if env::var("WEBKIT_DISABLE_DMABUF_RENDERER").is_err() {
898+
unsafe {
899+
env::set_var("WEBKIT_DISABLE_DMABUF_RENDERER", "1");
900+
}
901+
}
902+
// Disable compositing mode to avoid rendering issues
903+
if env::var("WEBKIT_DISABLE_COMPOSITING_MODE").is_err() {
904+
unsafe {
905+
env::set_var("WEBKIT_DISABLE_COMPOSITING_MODE", "1");
906+
}
907+
}
908+
// Force X11 backend if on Wayland (more stable for WebKit)
909+
if env::var("GDK_BACKEND").is_err() && env::var("WAYLAND_DISPLAY").is_ok() {
910+
unsafe {
911+
env::set_var("GDK_BACKEND", "x11");
912+
}
913+
}
914+
}
915+
890916
// Store backend process handle in app state
891917
let backend_process: Mutex<Option<Child>> = Mutex::new(None);
892918

0 commit comments

Comments
 (0)