tauri icon indicating copy to clipboard operation
tauri copied to clipboard

[feat] Support applicationShouldTerminate(_:) for macOS graceful shutdown handling

Open nathancovey opened this issue 9 months ago • 1 comments

Describe the problem

I’m always frustrated when Tauri applications on macOS do not have a way to gracefully handle app termination requests from the system. Currently, when a user quits the application (via Cmd+Q or pressing the dock icon and then "quit"), the app immediately exits without an opportunity to intercept and prompt the user to save their work or perform cleanup tasks.

Describe the solution you'd like

I would like Tauri to support the applicationShouldTerminate (https://developer.apple.com/documentation/appkit/nsapplicationdelegate/applicationshouldterminate(_:)) delegate method on macOS. This would allow developers to:

  • Intercept termination requests
  • Prompt users to confirm quitting or save their work (using dialog plugin)
  • Perform cleanup tasks before the app exits
  • Potentially delay or cancel termination if needed

And no, ExitRequested event in Tauri does not do this. I'm not sure what that is supposed to do tbh.

Alternatives considered

No response

Additional context

No response

nathancovey avatar Mar 14 '25 19:03 nathancovey

I Second this, I also require this feature to be included in tauri as in a lot of cases, this is required. I think i have seen some electron apps do it. i dont know if there any way to do it in tauri currently, so i request for the feature too.

proxie-ghanshyam avatar Jun 16 '25 04:06 proxie-ghanshyam

closing in favor of the older #9198

FabianLars avatar Jul 08 '25 12:07 FabianLars