diff --git a/src-tauri/src/core/mod.rs b/src-tauri/src/core/mod.rs index ac01442..ec4e396 100644 --- a/src-tauri/src/core/mod.rs +++ b/src-tauri/src/core/mod.rs @@ -48,9 +48,10 @@ pub struct Core { impl Core { pub fn new() -> Core { let clash = Clash::new(); - let verge = Verge::new(); + let mut verge = Verge::new(); let profiles = Profiles::new(); let service = Service::new(); + verge.launch_flag = Some(true); Core { clash: Arc::new(Mutex::new(clash)), @@ -382,10 +383,11 @@ impl Core { result.error.map(|err| log::error!("{err}")); }); - let verge = self.verge.lock(); + let mut verge = self.verge.lock(); let silent_start = verge.enable_silent_start.clone(); - if silent_start.unwrap_or(false) { + if silent_start.unwrap_or(false) && verge.launch_flag.unwrap_or(false) { window.emit("script-handler-close", payload).unwrap(); + verge.launch_flag = Some(false); } else { window.emit("script-handler", payload).unwrap(); } diff --git a/src-tauri/src/core/verge.rs b/src-tauri/src/core/verge.rs index a03bde4..0db1621 100644 --- a/src-tauri/src/core/verge.rs +++ b/src-tauri/src/core/verge.rs @@ -37,6 +37,10 @@ pub struct Verge { /// enable proxy guard pub enable_proxy_guard: Option, + /// launch flag + #[serde(skip_serializing)] + pub launch_flag: Option, + /// set system proxy bypass pub system_proxy_bypass: Option,