mirror of
https://github.com/ByteAtATime/raycast-linux.git
synced 2025-09-12 17:06:26 +00:00
feat(app): hide window instead of closing
Instead of closing the window, this commit changes the event listener so that it simply hides the window instead. This allows for near-instant re-opening of the window, as well as state preservation.
This commit is contained in:
parent
3cb7f984b2
commit
9d73ac0a23
1 changed files with 16 additions and 3 deletions
|
@ -175,7 +175,7 @@ fn setup_input_listener(app: &tauri::AppHandle) {
|
||||||
|
|
||||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||||
pub fn run() {
|
pub fn run() {
|
||||||
tauri::Builder::default()
|
let app = tauri::Builder::default()
|
||||||
.plugin(tauri_plugin_fs::init())
|
.plugin(tauri_plugin_fs::init())
|
||||||
.plugin(tauri_plugin_dialog::init())
|
.plugin(tauri_plugin_dialog::init())
|
||||||
.plugin(tauri_plugin_http::init())
|
.plugin(tauri_plugin_http::init())
|
||||||
|
@ -271,6 +271,19 @@ pub fn run() {
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
})
|
})
|
||||||
.run(tauri::generate_context!())
|
.build(tauri::generate_context!()).unwrap();
|
||||||
.expect("error while running tauri application");
|
|
||||||
|
app.run(|app, event| {
|
||||||
|
if let tauri::RunEvent::WindowEvent {
|
||||||
|
event: tauri::WindowEvent::CloseRequested { api, .. },
|
||||||
|
..
|
||||||
|
} = event
|
||||||
|
{
|
||||||
|
api.prevent_close();
|
||||||
|
app.get_webview_window("main")
|
||||||
|
.unwrap()
|
||||||
|
.hide()
|
||||||
|
.expect("To hide the window");
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue