ui
ui copied to clipboard
How can I make more complex menus?
Specifically for macOS, is there any way to make more complex menus for ui apps?
Trying to stay away from something as bulky as Electron for my application but I need both better menu support and tray support for mac
I need to redo the menu API entirely. I've already decided that tray support is outside the scope of libui.
@andlabs While I understand the motivation to separate those, there is an issue on Mac OS that prevents doing that -- exactly the issue of only Main Thread being able to update UI (this also concerns tray menus and notifications).
I've tried to use ui + trayhost (and few alternatives), but I get stuck on the same issue of each library wanting to run it's own event loop and thus crashing the app entirely when 2nd one tries to start (e.g. I first call to ui and then to trayhost, then I will get crash on trayhost call, in reverse order I will get crash on ui call). Without having tray/menu handling in ui, no apps built with it will ever have it.
This is exactly the reason why Qt (for example) has all of that included into it already, because you can't really separate those parts (oh and semantically tray icons and menus are part of the UI interface, aren't they?).
Good point. I wonder if any of these tray libraries can be told to just hook up to an existing UI event loop; after all, libappindicator is a separate library from GTK+ (which is one of the big reasons I don't want to add it to libui directly)... If not, I might consider it, but that still wouldn't fix the problem of me not being satisfied with the current menu API.
@andlabs
If not, I might consider it, but that still wouldn't fix the problem of me not being satisfied with the current menu API.
I think it is okay not to like those :D but the point is that Go developers need that sort of framework, and yours (IMO) is the perfect candidate to be the one.
I wonder if any of these tray libraries can be told to just hook up to an existing UI event loop
I did not find anything like that. On the other hand I think ui
could be a good candidate to do that. This could be extras
package that is not default and hooks into ui's event loop.
Complex menus is replaced with andlabs/libui#321.
I still don't know if package ui will be able to hook into other event loops. trayhost might be better off providing a way to hook into an existing event loop, if it even needs to and if simply running on the same OS thread isn't enough. (It should not be specific to package ui.)