handle app close uniformly xplatform
This commit is contained in:
parent
e307da8544
commit
821e12bdf6
2 changed files with 3 additions and 8 deletions
|
|
@ -98,6 +98,8 @@ pub fn run() {
|
||||||
})
|
})
|
||||||
.on_window_event(|window, event| match event {
|
.on_window_event(|window, event| match event {
|
||||||
tauri::WindowEvent::CloseRequested { api, .. } => {
|
tauri::WindowEvent::CloseRequested { api, .. } => {
|
||||||
|
api.prevent_close();
|
||||||
|
let _res = window.hide();
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
{
|
{
|
||||||
let res = window
|
let res = window
|
||||||
|
|
@ -107,10 +109,8 @@ pub fn run() {
|
||||||
println!("Failed to set activation policy: {}", e);
|
println!("Failed to set activation policy: {}", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
api.prevent_close();
|
|
||||||
|
|
||||||
// TODO may be different on windows, this works for macos
|
// TODO may be different on windows, this works for macos
|
||||||
tauri::AppHandle::hide(window.app_handle()).unwrap();
|
// tauri::AppHandle::hide(window.app_handle()).unwrap();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use std::sync::Mutex;
|
use std::sync::Mutex;
|
||||||
use std::thread;
|
|
||||||
use tauri::{App, Manager};
|
use tauri::{App, Manager};
|
||||||
use whisper_rs::install_whisper_log_trampoline;
|
use whisper_rs::install_whisper_log_trampoline;
|
||||||
use whisper_rs::{
|
use whisper_rs::{
|
||||||
|
|
@ -46,10 +45,6 @@ impl TranscriptionManager {
|
||||||
return Ok(result);
|
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();
|
let mut state = self.state.lock().unwrap();
|
||||||
// Initialize parameters
|
// Initialize parameters
|
||||||
let mut params = FullParams::new(SamplingStrategy::default());
|
let mut params = FullParams::new(SamplingStrategy::default());
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue