From b9c2dab48203dd0ac9c73e4e0fc41be3247b65ad Mon Sep 17 00:00:00 2001 From: FTCHD <144691102+FTCHD@users.noreply.github.com> Date: Tue, 14 Oct 2025 02:46:37 +0200 Subject: [PATCH] avoid linux crashes Fixes #4 #51 #52 #53 Signed-off-by: FTCHD <144691102+FTCHD@users.noreply.github.com> --- src-tauri/src/main.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 0cb3979..e4b1bd7 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -1,7 +1,17 @@ -// Prevents additional console window on Windows in release, DO NOT REMOVE!! #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] fn main() { + #[cfg(target_os = "linux")] + { + let is_dri_present = std::path::Path::new("/dev/dri").exists(); + let is_wayland = std::env::var("WAYLAND_DISPLAY").is_ok(); + let is_x11_session = std::env::var("XDG_SESSION_TYPE").unwrap_or_default() == "x11"; + if is_dri_present && !is_wayland && is_x11_session { + if std::env::var_os("__NV_DISABLE_EXPLICIT_SYNC").is_none() { + std::env::set_var("__NV_DISABLE_EXPLICIT_SYNC", "1"); + } + } + } let _ = fix_path_env::fix(); app_lib::run(); }