diff --git a/backend/Cargo.lock b/backend/Cargo.lock index b95c88559c..15a229e2af 100644 --- a/backend/Cargo.lock +++ b/backend/Cargo.lock @@ -754,9 +754,11 @@ dependencies = [ "tracing-subscriber", "uuid", "warp", + "webview2-com", "which 6.0.0", "window-shadows", "window-vibrancy", + "windows 0.39.0", "windows-sys 0.52.0", "winreg 0.52.0", "wry", diff --git a/backend/tauri/Cargo.toml b/backend/tauri/Cargo.toml index d9b08f5b61..0c37fa0971 100644 --- a/backend/tauri/Cargo.toml +++ b/backend/tauri/Cargo.toml @@ -96,6 +96,8 @@ windows-sys = { version = "0.52", features = [ "Win32_System_LibraryLoader", "Win32_System_SystemInformation", ] } +webview2-com = "0.19" +windows = "0.39" [target.'cfg(windows)'.dependencies.tauri] version = "1.5.4" diff --git a/backend/tauri/src/main.rs b/backend/tauri/src/main.rs index 5a0ddc87d3..606e4c4d9b 100644 --- a/backend/tauri/src/main.rs +++ b/backend/tauri/src/main.rs @@ -17,6 +17,8 @@ use crate::{ }; use anyhow::Context; use tauri::{api, Manager, SystemTray}; +use webview2_com::Microsoft::Web::WebView2::Win32::ICoreWebView2Settings6; +use windows::core::Interface; rust_i18n::i18n!("../../locales"); @@ -130,6 +132,21 @@ fn main() -> std::io::Result<()> { handle.emit_all("scheme-request-received", request).unwrap(); } )); + let window = app.get_window("main").unwrap(); + #[cfg(target_os = "windows")] + window + .with_webview(|webview| unsafe { + let settings = webview + .controller() + .CoreWebView2() + .unwrap() + .Settings() + .unwrap(); + let settings: ICoreWebView2Settings6 = + settings.cast::().unwrap(); + settings.SetIsSwipeNavigationEnabled(false).unwrap(); + }) + .unwrap(); Ok(()) }) .on_system_tray_event(core::tray::Tray::on_system_tray_event)