|
@@ -107,6 +107,7 @@ pub fn create_window(app_handle: &AppHandle) {
|
|
|
tauri::WindowUrl::App("index.html".into()),
|
|
|
)
|
|
|
.title("Clash Verge")
|
|
|
+ .visible(false)
|
|
|
.fullscreen(false)
|
|
|
.min_inner_size(600.0, 520.0);
|
|
|
|
|
@@ -138,8 +139,6 @@ pub fn create_window(app_handle: &AppHandle) {
|
|
|
|
|
|
#[cfg(target_os = "windows")]
|
|
|
{
|
|
|
- use std::time::Duration;
|
|
|
- use tokio::time::sleep;
|
|
|
use window_shadows::set_shadow;
|
|
|
|
|
|
match builder
|
|
@@ -173,19 +172,11 @@ pub fn create_window(app_handle: &AppHandle) {
|
|
|
log::trace!("try to create window");
|
|
|
let app_handle = app_handle.clone();
|
|
|
|
|
|
- // 加点延迟避免界面闪一下
|
|
|
- tauri::async_runtime::spawn(async move {
|
|
|
- sleep(Duration::from_millis(888)).await;
|
|
|
-
|
|
|
- if let Some(window) = app_handle.get_window("main") {
|
|
|
- trace_err!(set_shadow(&window, true), "set win shadow");
|
|
|
- trace_err!(window.show(), "set win visible");
|
|
|
- trace_err!(window.unminimize(), "set win unminimize");
|
|
|
- trace_err!(window.set_focus(), "set win focus");
|
|
|
- } else {
|
|
|
- log::error!(target: "app", "failed to create window, get_window is None")
|
|
|
- }
|
|
|
- });
|
|
|
+ if let Some(window) = app_handle.get_window("main") {
|
|
|
+ trace_err!(set_shadow(&window, true), "set win shadow");
|
|
|
+ } else {
|
|
|
+ log::error!(target: "app", "failed to create window, get_window is None")
|
|
|
+ }
|
|
|
}
|
|
|
Err(err) => log::error!(target: "app", "failed to create window, {err}"),
|
|
|
}
|