fix(tamagotchi): process stuck when create settings window on Windows (#154)

This commit is contained in:
LemonNeko
2025-05-01 18:49:33 +08:00
committed by GitHub
parent 8396ca78e9
commit b96120ec7e
4 changed files with 61 additions and 1 deletions
Generated
+53
View File
@@ -102,6 +102,7 @@ dependencies = [
"tauri-plugin-log",
"tauri-plugin-mcp",
"tauri-plugin-os",
"tauri-plugin-prevent-default",
]
[[package]]
@@ -781,6 +782,12 @@ version = "1.0.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c7a8fb8a9fbf66c1f703fe16184d10ca0ee9d23be5b4436400408ba54a95005"
[[package]]
name = "either"
version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
[[package]]
name = "embed-resource"
version = "3.0.2"
@@ -1692,6 +1699,15 @@ version = "2.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130"
[[package]]
name = "itertools"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285"
dependencies = [
"either",
]
[[package]]
name = "itoa"
version = "0.4.8"
@@ -3375,6 +3391,28 @@ version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
[[package]]
name = "strum"
version = "0.27.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f64def088c51c9510a8579e3c5d67c65349dcf755e5479ad3d010aa6454e2c32"
dependencies = [
"strum_macros",
]
[[package]]
name = "strum_macros"
version = "0.27.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c77a8c5abcaf0f9ce05d62342b7d298c346515365c36b673df4ebe3ced01fde8"
dependencies = [
"heck 0.5.0",
"proc-macro2",
"quote",
"rustversion",
"syn 2.0.101",
]
[[package]]
name = "swift-rs"
version = "1.0.7"
@@ -3698,6 +3736,21 @@ dependencies = [
"thiserror 2.0.12",
]
[[package]]
name = "tauri-plugin-prevent-default"
version = "1.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20327367bca73bc4a08973592b0e6fe716321566207c52c79234876a5467c4ac"
dependencies = [
"bitflags 2.9.0",
"itertools",
"serde",
"strum",
"tauri",
"tauri-plugin",
"thiserror 2.0.12",
]
[[package]]
name = "tauri-runtime"
version = "2.6.0"
@@ -32,3 +32,4 @@ tauri = { version = "2.3.1", features = [
tauri-plugin-log = "2.0.0-rc"
tauri-plugin-os = "2"
tauri-plugin-mcp = { workspace = true }
tauri-plugin-prevent-default = "1.3"
@@ -2,7 +2,7 @@ use std::path::Path;
use tauri::{Manager, WebviewUrl, WebviewWindowBuilder};
#[tauri::command]
pub fn open_settings_window(app: tauri::AppHandle) {
pub async fn open_settings_window(app: tauri::AppHandle) {
if let Some(window) = app.get_webview_window("settings") {
let _ = window.show();
return;
@@ -4,12 +4,18 @@ use tauri::tray::TrayIconBuilder;
#[cfg(target_os = "macos")]
use tauri::{ActivationPolicy, TitleBarStyle};
use tauri::{Manager, WebviewUrl, WebviewWindowBuilder};
use tauri_plugin_prevent_default::Flags;
mod commands;
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
let prevent_default_plugin = tauri_plugin_prevent_default::Builder::new()
.with_flags(Flags::RELOAD)
.build();
tauri::Builder::default()
.plugin(prevent_default_plugin)
.plugin(tauri_plugin_mcp::Builder.build())
.plugin(tauri_plugin_os::init())
.setup(|app| {