Revert "chore: remove useless exit codes and hooks"

This reverts commit 40ff3fd4bf59f52f23904c3150de6ff17974d23f.
This commit is contained in:
huzibaca 2024-09-22 00:41:20 +08:00
parent 84fe9c84a8
commit e9721ecc4d
No known key found for this signature in database
GPG Key ID: D4364EE4851DC302
3 changed files with 5 additions and 0 deletions

View File

@ -428,6 +428,7 @@ fn on_menu_event(app_handle: &AppHandle, event: MenuEvent) {
"restart_clash" => feat::restart_clash_core(), "restart_clash" => feat::restart_clash_core(),
"restart_app" => tauri::process::restart(&app_handle.env()), "restart_app" => tauri::process::restart(&app_handle.env()),
"quit" => { "quit" => {
println!("quit");
feat::quit(); feat::quit();
} }
_ => {} _ => {}

View File

@ -110,6 +110,7 @@ pub fn quit() {
let _ = resolve::save_window_size_position(&app_handle, true); let _ = resolve::save_window_size_position(&app_handle, true);
resolve::resolve_reset(); resolve::resolve_reset();
app_handle.exit(0); app_handle.exit(0);
std::process::exit(0);
} }
} }

View File

@ -134,6 +134,9 @@ pub fn run() {
.expect("error while running tauri application"); .expect("error while running tauri application");
app.run(|app_handle, e| match e { app.run(|app_handle, e| match e {
tauri::RunEvent::ExitRequested { api, .. } => {
api.prevent_exit();
}
tauri::RunEvent::WindowEvent { label, event, .. } => { tauri::RunEvent::WindowEvent { label, event, .. } => {
if label == "main" { if label == "main" {
match event { match event {