-
-
Notifications
You must be signed in to change notification settings - Fork 196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support activate
event on macOS
#218
Comments
Sound great! |
I am very interested in this feature as well |
Three years have passed and this feature has not been implemented yet? |
See here for a working example, the feature exists, it's just not very explicit https://github.com/martpie/museeks/blob/tauri/src-tauri/src/plugins/app_close.rs Or there reply to the main Tauri issue: tauri-apps/tauri#3084 (comment) |
it's actually not the same thing, the activate event is a event that you can handle when user click the dock icon, the plugin just mimic the effect of show the window on the event, and if you use the plugin, the window will not actually close when user click the close button |
This solution is useless when the business has multiple windows. |
I'm also interested in |
I can't believe it takes that long to send an event in response to |
since tao is a fork of winit and it's planned to keep features sync with it(#470) for switch back to it in the feature, so probably need this issue(rust-windowing/winit#2120) be completed |
the switch back to winit has been delayed indefinitely for now, let's move forward and worry about the switch later. |
We've broken compatibility with 2120 a few times already anyway ^^ |
As @BillGoldenWater mentioned and I had verified that NSApplicationActivatedEventType is not a solution. For example when user closes the last visible window, the app stays focused, i.e the menu is still visible in the top left corner in the menubar and the click on dock does not fire |
@pronebird It's not intended to do that. It's a "focus" event in the app (not on windows). It's useful if you click the icon when the app isn't in focus, or when the app is closed to the tray and you try to open it from applications or from the dock. It will focus the app, and the activated event will emit. Could you clarify why you need the event when the user clicks the icon while the app is already in focus? |
This issue by my understand is about emit an event when click on the dock icon regardless the state of focus |
and a side note, the appkit::NSEventSubtype::NSApplicationActivatedEventType is deprecated |
The problem is that when the user closes the last visible window, the app stays in focus. To my understanding, the click on dock tile would typically open a new "untitled document" window, in a typical document based native app. But there is no hook for that in tauri. As a side note, I already capture I would actually like to show the new window if user clicks on dock tile when there are no visible windows left. This is what |
Thanks, so I tested shouldHandleReopen from #517 and it works great on
I hope that it will be merged soon, added to Wry, and make its way into Tauri finally Update: merged to tao and soon to tauri |
yeah totally that should also work for single instance plugin and eliminate the need for flock-based mutex or whatever is used there. |
It won't work for the single instance plugin, or at least can't replace the current logic. The single instance plugin on MacOS really only handles when the app is opened from the console which doesn't emit this event (otherwise the MacOS native single instance mechanism would trigger already) |
Any console or just |
any console. the contributor(s) iirc had a cli interface for their app in build mode too and that didn't trigger the macos single instance mechanism. |
Hey 👋, excuse me! Did you implement the |
Is your feature request related to a problem? Please describe.
On macOS clicking the applications dock icon does a few things depending on the context:
Afaik all these events are communicated through the
appkit::NSEventSubtype::NSApplicationActivatedEventType
event. Can we expose this even to consumers somehow?Describe the solution you'd like
Add an
ActivationEvent
member to thetao::event::Event
enum. This would mirror theappkit::NSEventSubtype::NSApplicationActivatedEventType
event.Describe alternatives you've considered
Some of this can be implemented through the use of
WindowEvent::Focus
, but that will only be fired on a per-window basis, not when all windows are closed.Would you assign yourself to implement this feature?
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: