//! ThoughtSync desktop (Tauri v2). //! //! The window loads the shared Vue 3 frontend (`../../frontend`). The Rust core will //! own the on-device SQLite store (M10.4) and the opt-in sync engine (M10.7), which //! the frontend reaches through the `frontend/src/adapters/` seam (M10.3) over Tauri //! `invoke`. Today it exposes desktop integration (menu-entry install for the Linux //! AppImage) and boots the UI. 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, integration::integrate_desktop, integration::unintegrate_desktop, ]) .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); } } }