diff --git a/src-tauri/src/config/config.rs b/src-tauri/src/config/config.rs index d2f37058..edc85faa 100644 --- a/src-tauri/src/config/config.rs +++ b/src-tauri/src/config/config.rs @@ -6,7 +6,7 @@ use crate::{ }; use anyhow::{anyhow, Result}; use once_cell::sync::OnceCell; -use std::{env::temp_dir, path::PathBuf}; +use std::path::PathBuf; pub const RUNTIME_CONFIG: &str = "clash-verge.yaml"; pub const CHECK_CONFIG: &str = "clash-verge-check.yaml"; diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index efa8d1bc..136692e7 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -143,13 +143,10 @@ pub fn run() { match event { tauri::WindowEvent::CloseRequested { api, .. } => { println!("closing window..."); + let _ = resolve::save_window_size_position(true); api.prevent_close(); let window = core::handle::Handle::global().get_window().unwrap(); log_err!(window.minimize()); - let _ = resolve::save_window_size_position(true); - } - tauri::WindowEvent::Moved(_) | tauri::WindowEvent::Resized(_) => { - let _ = resolve::save_window_size_position(false); } tauri::WindowEvent::Focused(true) => { #[cfg(target_os = "macos")]