handle app close uniformly xplatform

This commit is contained in:
CJ Pais 2025-05-15 13:20:54 -07:00
parent e307da8544
commit 821e12bdf6
2 changed files with 3 additions and 8 deletions

View file

@ -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();
}
}
_ => {}

View file

@ -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());