#Unable to relaunch the application after closing it while running in background

5 messages · Page 1 of 1 (latest)

prime rivet
#

Hey there, so I have been using this from the documentation to make the frontend run in background after the user close the app:

tauri::Builder::default().on_window_event(|event| match event.event() {
  tauri::WindowEvent::CloseRequested { api, .. } => {
    event.window().hide().unwrap();
    api.prevent_close();
  }
  _ => {}
})
.run(tauri::generate_context!())
.expect("error while running tauri application");

https://tauri.app/v1/guides/features/system-tray/#configure-the-app-system-tray

And it all works fine and well because I see the app is still running when I close it however, I have trouble making the UI re-appear after closing it. I just see the icon on my taskbar but clicking on it doesn't reopen it (I'm on mac). Is that a normal behavior that is just happening in debug mode or is there a way to do it?

Thanks!

true siren
#

this is somewhat normal, there is no dock icon click event yet (there will be in v2, maybe backported to v1) and after a community member showed me that it is indeed possible i will continue working on my "apple-events" plugin which will make this possible in any v1 version (will still take some time, i have to focus on other things)

general tracking issue: https://github.com/tauri-apps/tauri/issues/3084

#

Another thing you could try is instead of hiding the window you can hide the whole app via event.window().app_handle().hide(), maybe macos handles reopening itself then

prime rivet
#

sorry for the late reply