diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 26a7e85..88b0c67 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -7,7 +7,6 @@ use tauri::Manager; use ustb_wifi_tools::commands::*; use ustb_wifi_tools::entities::AppState; use ustb_wifi_tools::setting::Setting; -use ustb_wifi_tools::utils::get_windows_build_number; fn main() { tauri::Builder::default() @@ -53,11 +52,15 @@ fn background_init(app: &mut tauri::App) -> Result<(), Box= 22000 { - window_vibrancy::apply_mica(&win, None).map_err(|err| format!("启动错误: {}", err))?; - } else { - window_vibrancy::apply_blur(&win, Some((18, 18, 18, 125))).map_err(|err| format!("启动错误: {}", err))?; + { + use ustb_wifi_tools::utils::get_windows_build_number; + if get_windows_build_number()? >= 22000 { + window_vibrancy::apply_mica(&win, None).map_err(|err| format!("启动错误: {}", err))?; + } else { + window_vibrancy::apply_blur(&win, Some((18, 18, 18, 125))) + .map_err(|err| format!("启动错误: {}", err))?; + } } - + Ok(()) } diff --git a/src-tauri/src/utils.rs b/src-tauri/src/utils.rs index 292ecae..1d706a7 100644 --- a/src-tauri/src/utils.rs +++ b/src-tauri/src/utils.rs @@ -135,6 +135,7 @@ pub fn login_via_headless_browser(browser_path: PathBuf, account: &Account) -> R Ok(res) } + #[cfg(target_os = "windows")] pub fn get_windows_build_number() -> Result> { use std::{process::Command, str::from_utf8}; @@ -177,6 +178,7 @@ mod test { } #[test] + #[cfg(target_os = "windows")] fn test_get_windows_build_number() { let res = get_windows_build_number(); dbg!(res.unwrap());