[ANN] Cross-platform HTML/CSS GUI library

279 views
Skip to first unread message

Serge Zaitsev

unread,
Oct 25, 2017, 8:39:42 AM10/25/17
to golang-nuts
Hey all,

I made a tiny library that provides a cross-platform web UI for Go apps.


No dependencies on Windows and Mac. Gtk-Webkit is only required on Linux and OpenBSD.
Resulting binaries are much smaller and less resource-hungry comparing to Electron.
Supported browser engines are modern enough to let developers use HTML5/CSS3 without any quirks (on Windows IE10-IE11 are used).

I tried to keep Go API very simple, and the whole library is very concise, too.

JavaScript<->Go bindings are provided to let core app communicate with the UI.

I haven't thought much about how to architect such apps, but to me the reactive approach works really well (something similar to redux). I keep app state in Go as a structure, pass it as JSON to the UI and incrementally update the UI (using picodom.js).
Also, in response to UI actions I send a JSON describing the action and its parameters to Go where I handle it and update the state.

Apart from the app architecture, I wonder what features do you think this library lacks for your needs, or what could be done better.
Any ideas, feedback or critique are welcome.

Thanks!
Serge

Ain

unread,
Oct 25, 2017, 9:51:37 AM10/25/17
to golang-nuts

On Wednesday, October 25, 2017 at 3:39:42 PM UTC+3, Serge Zaitsev wrote:
Hey all,

I made a tiny library that provides a cross-platform web UI for Go apps.


Looks intresting, thanks for making it available!
 
 
 
Apart from the app architecture, I wonder what features do you think this library lacks for your needs, or what could be done better.
Any ideas, feedback or critique are welcome.

Of the top of my head:
 - callback when app is terminated (via the [x] button on titlebar);
 - ability to create native menu for the main wnd;
 - ability to set app icon.


ain

Serge Zaitsev

unread,
Oct 25, 2017, 10:14:05 AM10/25/17
to golang-nuts
Thanks for the feedback!

You know when the app is terminated because that's when the main loop ends (e.g. Loop() returns false, or Run() just returns). So you can write any code after webview.Run() and it will be executed when user presses close button.

App icon is something on my list. Currently, app icon can be set on Windows and Mac without any code (using .rc file or app bundle .icns file).
I also plan to make a function to set window icon for Gtk and Windows in runtime. So yes, it's definitely a high-priority. Webview apps should look like normal apps for the end user.

Menus on the other hand is definitely something important to have, but it is likely to bring a lot of code for all three platforms, and the API is likely to get more complex.
I think one day I will add that, too, but at the moment I can't promise much. Hopefully, tray menu can also be implemented by reusing most of the code.
Reply all
Reply to author
Forward
0 new messages