// Prevents an extra console window on Windows in release builds.
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]

use std::process::ExitCode;

fn main() -> ExitCode {
    // WebKitGTK's DMABUF renderer causes a blank/white window on many Linux
    // setups (recent Mesa/Nvidia drivers, common on Arch). Disable it before
    // the webview initializes, unless the user has explicitly set the variable.
    // Harmless for the headless `mcp-server` bridge path, which ignores it.
    #[cfg(target_os = "linux")]
    {
        if std::env::var_os("WEBKIT_DISABLE_DMABUF_RENDERER").is_none() {
            std::env::set_var("WEBKIT_DISABLE_DMABUF_RENDERER", "1");
        }
    }

    // Route argv before any Tauri/WebKit init: `mcp-server` ⇒ headless bridge.
    app_tauri_lib::dispatch()
}
