fyne-io / systray

a cross platfrom Go library to place an icon and menu in the notification area
Apache License 2.0
245 stars 49 forks source link

add systray.TrayOpenedCh which is triggered every time user clicks system tray #47

Closed pymq closed 5 months ago

pymq commented 1 year ago

My use case is to refresh some data each time user clicks icon and update submenus

Unfortunately I don't have mac to implement it on darwin

Probably related to #23

andydotxyz commented 1 year ago

Won't the unix implementation trigger every time a submenu is opened as well? This doesn't sound like what you intended from the PR title.

pymq commented 1 year ago

oh, thanks, you are right! fixed that

andydotxyz commented 1 year ago

Is there any way (or anyone listening) to get the macOS support added?

pymq commented 1 year ago

I found this example of similar feature, maybe it will help somebody. Without ways to test it I can't implement this, unfortunately

davidnewhall commented 1 year ago

🖖 I'd be happy to help test, but my usefulness at adapting Xcode/cocoa is pretty limited. The SO you linked looks promising, but all that "low-level" code is just not something I'm familiar with. That said, I maintain two heavily used apps that import the getlantern variant of this library. The fyne-io version seems like it should drop right in. I'm specifically looking for a way to open the apps' web ui when the menu is double-clicked. This contribution doesn't quite nail that, but it's pretty close, and moving it forward should make my goal easier to get to. If you'd like to stick some code into a branch and link me up, I'll tell you what happens on a Mac, at least. Might even be able to tinker on it. You can also drop my by discord and we can chat. https://golift.io/discord

thallgren commented 1 year ago

This PR would make our life easier. It also relates to this ticket that I just created. Anything I can do to help this getting merged? I can test on both Linux and macOS (Intel or Silicon).

andydotxyz commented 1 year ago

I think we're looking for the Darwin code to be slotted in then tested