From 53a240953f795a4a2e813e1c2c7300071e7e6385 Mon Sep 17 00:00:00 2001 From: lencx Date: Mon, 2 Jan 2023 17:40:33 +0800 Subject: [PATCH] chore: spawn --- src-tauri/src/app/setup.rs | 4 ++-- src-tauri/src/app/window.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src-tauri/src/app/setup.rs b/src-tauri/src/app/setup.rs index b926a9f..22681a5 100644 --- a/src-tauri/src/app/setup.rs +++ b/src-tauri/src/app/setup.rs @@ -10,7 +10,7 @@ pub fn init(app: &mut App) -> std::result::Result<(), Box let theme = ChatConfJson::theme(); let handle = app.app_handle(); - tokio::spawn(async move { + tauri::async_runtime::spawn(async move { window::tray_window(&handle); }); @@ -49,7 +49,7 @@ pub fn init(app: &mut App) -> std::result::Result<(), Box app.set_activation_policy(tauri::ActivationPolicy::Accessory); } else { let app = app.handle(); - tokio::spawn(async move { + tauri::async_runtime::spawn(async move { #[cfg(target_os = "macos")] WindowBuilder::new(&app, "core", WindowUrl::App(url.into())) .title("ChatGPT") diff --git a/src-tauri/src/app/window.rs b/src-tauri/src/app/window.rs index 546be04..e7a4294 100644 --- a/src-tauri/src/app/window.rs +++ b/src-tauri/src/app/window.rs @@ -6,7 +6,7 @@ pub fn tray_window(handle: &tauri::AppHandle) { let theme = conf::ChatConfJson::theme(); let app = handle.clone(); - tokio::spawn(async move { + tauri::async_runtime::spawn(async move { WindowBuilder::new(&app, "tray", WindowUrl::App(chat_conf.origin.into())) .title("ChatGPT") .resizable(false) @@ -28,7 +28,7 @@ pub fn tray_window(handle: &tauri::AppHandle) { pub fn control_window(handle: &tauri::AppHandle) { let app = handle.clone(); - tokio::spawn(async move { + tauri::async_runtime::spawn(async move { WindowBuilder::new(&app, "main", WindowUrl::App("index.html".into())) .title("Control Center") .resizable(true)