diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 3a57cdb..fd056ee 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -98,6 +98,8 @@ pub fn run() { }) .on_window_event(|window, event| match event { tauri::WindowEvent::CloseRequested { api, .. } => { + api.prevent_close(); + let _res = window.hide(); #[cfg(target_os = "macos")] { let res = window @@ -107,10 +109,8 @@ pub fn run() { println!("Failed to set activation policy: {}", e); } - api.prevent_close(); - // TODO may be different on windows, this works for macos - tauri::AppHandle::hide(window.app_handle()).unwrap(); + // tauri::AppHandle::hide(window.app_handle()).unwrap(); } } _ => {} diff --git a/src-tauri/src/managers/transcription.rs b/src-tauri/src/managers/transcription.rs index f142ceb..9757c66 100644 --- a/src-tauri/src/managers/transcription.rs +++ b/src-tauri/src/managers/transcription.rs @@ -1,6 +1,5 @@ use anyhow::Result; use std::sync::Mutex; -use std::thread; use tauri::{App, Manager}; use whisper_rs::install_whisper_log_trampoline; use whisper_rs::{ @@ -46,10 +45,6 @@ impl TranscriptionManager { return Ok(result); } - let num_threads = thread::available_parallelism() - .map(|count| count.get() as i32) - .unwrap_or(1); - let mut state = self.state.lock().unwrap(); // Initialize parameters let mut params = FullParams::new(SamplingStrategy::default());