diff --git a/src-tauri/src/core/mod.rs b/src-tauri/src/core/mod.rs index 2d8da94..967db76 100644 --- a/src-tauri/src/core/mod.rs +++ b/src-tauri/src/core/mod.rs @@ -91,16 +91,16 @@ impl Core { let clash = self.clash.lock(); let verge = self.verge.lock(); - let silent_start = verge.enable_silent_start.clone(); + // let silent_start = verge.enable_silent_start.clone(); let auto_launch = verge.enable_auto_launch.clone(); // silent start - if silent_start.unwrap_or(false) { - let window = self.window.lock(); - window.as_ref().map(|win| { - win.hide().unwrap(); - }); - } + // if silent_start.unwrap_or(false) { + // let window = self.window.lock(); + // window.as_ref().map(|win| { + // win.hide().unwrap(); + // }); + // } let mut sysopt = self.sysopt.lock(); diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index c1891ac..b5d3978 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -158,8 +158,15 @@ fn main() -> std::io::Result<()> { builder = builder.menu(Menu::new().add_submenu(submenu_file)); } + let mut context = tauri::generate_context!(); + let verge = Verge::new(); + for win in context.config_mut().tauri.windows.iter_mut() { + if verge.enable_silent_start.unwrap_or(false) { + win.visible = false; + } + } builder - .build(tauri::generate_context!()) + .build(context) .expect("error while running tauri application") .run(|app_handle, e| match e { tauri::RunEvent::ExitRequested { api, .. } => {