Closed thewh1teagle closed 6 months ago
Thanks for contributing! I am not one of the main maintainers so take this with a grain of salt, but i've worked with events a while back and i think that this feature should use the NSApplicationDelegate
's shouldHandleReopen method instead. The problem with that is that we'd need to figure out how to return a bool dynamically (or always false
since the default behavior doesn't seem to apply to tauri apps anyway).
Ahh, i forgot. We already have a PR for what i just said: https://github.com/tauri-apps/tao/pull/517
Oh I didn't knew about this event, that looks better because we can control the default behavior too. Does tao / tauri already use winit? (Like mentioned there) So we can merge it?
No, and winit still doesn't support this. But we've changed the approach since then and started merging PRs that use platform specific apis even if winit doesn't support them yet.
applicationShouldHandleReopen sounds like a thing used for document based apps.
I found it simpler to rely on applicationDidBecomeActive which fires every time the app activates.
I think this event isn't a solution for #218, it's not emitted for the click on dock icon, and it's emitted every time the app gains focus
I think it's usage would be pair with applicationDidResignActive and their "will" variant for handle lose/gain focus of entire app
@BillGoldenWater I think you're right, it doesn't trigger if the app is in focus but doesn't have any windows open.
This PR adds Activated event for
macOS
, resolving #218.Useful in two cases:
Activated
event.macOS
usually brings the already open instance to the front (without activating windows, so nothing happens). With this change, theActivated
event will be emitted in such cases.