fix: delay show window

This commit is contained in:
GyDi 2022-08-15 01:37:26 +08:00
parent 78f97ce4df
commit 8bf78fef10
No known key found for this signature in database
GPG Key ID: 1C95E0D3467B3084

View File

@ -88,6 +88,8 @@ pub fn create_window(app_handle: &AppHandle) {
#[cfg(target_os = "windows")] #[cfg(target_os = "windows")]
{ {
use crate::utils::winhelp; use crate::utils::winhelp;
use std::time::Duration;
use tokio::time::sleep;
use window_shadows::set_shadow; use window_shadows::set_shadow;
use window_vibrancy::apply_blur; use window_vibrancy::apply_blur;
@ -101,6 +103,8 @@ pub fn create_window(app_handle: &AppHandle) {
let app_handle = app_handle.clone(); let app_handle = app_handle.clone();
tauri::async_runtime::spawn(async move { tauri::async_runtime::spawn(async move {
sleep(Duration::from_secs(1)).await;
if let Some(window) = app_handle.get_window("main") { if let Some(window) = app_handle.get_window("main") {
let _ = window.show(); let _ = window.show();
let _ = set_shadow(&window, true); let _ = set_shadow(&window, true);