News for hackers. Stuff that matters.
Re:Golang Desktop App with Webview/Lorca, WASM and Bazel by pjmlp on Tuesday August 11, 2020 @03:51AM (#24118147)
The workarounds one goes through to avoid native frameworks.

"Hands-On GUI Application Development in Go: Build responsive, cross-platform, graphical applications with the Go programming language"

https://www.amazon.de/-/en/Andrew-Williams-ebook/dp/B07GYLYS...

Re:Golang Desktop App with Webview/Lorca, WASM and Bazel by fileeditview on Tuesday August 11, 2020 @04:39AM (#24118409)
Didn't read the book but I had a looong look at all kinds of "native" Go Gui toolkits and have to say there is none ready for professional / commercial cross-platform GUI applications.

The "old" frameworks such as the GTK bindings are either unmaintaned or not complete or both. The new frameworks like Gio and Fyne are promising but not there yet. Maybe in 1-2 years if they are being worked on consistently.

I really wish to do my upcoming project natively in Go (also Rust would be fine) but I don't see how.

Regarding web technology as desktop solution: all of those solutions including Go are just a mess IMO. They force go into the stack even when it doesn't make sense. Write the frontend in Go, compile it to WASM, wrap it in some browser.. it's just more complexity for no real gain.

There are some promising ideas, such as webview and wails but again not production-ready.

My conclusion: if you are willing to use web technologies, just use electron at the moment.

With Go the only "possible" way is to write a server and open a tab in your browser. But if people would accept this as desktop solution is another question.

Re:Golang Desktop App with Webview/Lorca, WASM and Bazel by pqb on Tuesday August 11, 2020 @09:06AM (#24119869)
Indeed, however I think we might replace Go with any programming language and your comment will still make sense. Currently, web-browsers are the best have-it-all platforms, and outside web-technologies there isn't many good alternatives. We landed in 2020 and we don't have any complete, native-like, cross-platform GUI toolkit (if we skip Qt and GTK).

In last years a lot projects have appeared, which were trying to compete in GUI toolkit market share. All of them had its scope limited, however they brought quite fresh look on declarative programming interface [0][1], superb 2D rendering pipeline [2][3], ease of embedding [4] and adaption to low-power devices [5] but none of them is "complete".

Personally, I am amazed of the implementation of rxi/lite [6], which is just an app (C with Lua) based on SDL2 library. It uses 2x less RAM than sublime on 1GB file, has lower latency, covers clipboard, keyboard, mouse, drag and drop, some context menus but does it feel native? No. Among many issues, it is easy to report an error with screen-reading software but it is quite common problem in all aforementioned.

Perhaps in future, something like LSP specification will see a daylight, which in outcome will helps us to provide universal, modular, limited to certain scope libraries that can be easily plugged in case of need. Maybe then we will came closer to "native" GUIs. In my experience, there are numerous developers who were trying hard to deliver "complete" GUI toolkit but have failed.

[0]: https://github.com/cycfi/elements

[1]: https://flutter.dev/

[2]: https://github.com/linebender/druid

[3]: https://github.com/servo/pathfinder

[4]: https://github.com/ocornut/imgui

[5]: https://github.com/Immediate-Mode-UI/Nuklear

[6]: https://github.com/rxi/lite

Re:Golang Desktop App with Webview/Lorca, WASM and Bazel by fileeditview on Tuesday August 11, 2020 @12:33PM (#24122261)
Funny how i have visited almost all of your links before. Do I understand it correctly that rxi/lite is just using plain SDL2 underneath to render the UI, do input processing, windowing,..? They must have had a lot of work implementing all of that. I always wondered why there are no well known ui frameworks on top of SDL.
Re:Golang Desktop App with Webview/Lorca, WASM and Bazel by pqb on Wednesday August 12, 2020 @05:58AM (#24130207)
Yes, that's right. To be honest, I spent some time already to inspect and analyze its code, because I found it as a nice example to learn Rust by rewriting this project.

rxi/lite have tens of functions in C to provide operation of file-system, implement fuzzy-finder or simple rendering calls for rectangles. Rest of code is written in Lua that shares a lot of signature-compatible functions with Sublime Text API. There is only Lua, STB (stb_truetype) and SDL2. Also compilation script is basic shell script [0].

It is also worth noting there is interesting contribution to provide sub-pixel rendering [1] (now, a fork [2]) which includes usage of libagg [3].

[0]: https://github.com/rxi/lite/blob/master/build.sh

[1]: https://github.com/rxi/lite/issues/145#issuecomment-64155409...

[2]: https://github.com/franko/lite-xl

[3]: http://antigrain.com/

Re:Golang Desktop App with Webview/Lorca, WASM and Bazel by jhoechtl on Tuesday August 11, 2020 @05:18PM (#24126097)
> We landed in 2020 and we don't have any complete, native-like, cross-platform GUI toolkit (if we skip Qt and GTK).

So we have QT and GTK ...

Re:Golang Desktop App with Webview/Lorca, WASM and Bazel by graynk on Tuesday August 11, 2020 @09:00AM (#24119808)
> The "old" frameworks such as the GTK bindings are either unmaintaned or not complete or both

gotk3 is maintained and most of the widgets are in place (technically it's not "complete", sure, but still).

My biggest gripe with it is that the whole documentation is just absolutely useless string of "this function is a wrapper for this function in C" over and over again instead of it being, well, the documentation for the function that is being wrapped.

Re:Golang Desktop App with Webview/Lorca, WASM and Bazel by fileeditview on Tuesday August 11, 2020 @11:25AM (#24121300)
Interesting.. I would have sworn that I just visited the gotk3 Github page and the project was archived.. very strange.

But good to know. And yes I forgot to mention the documentation.. you are absolutely right.. so far I have had that experience with all things GTK.

Re:Golang Desktop App with Webview/Lorca, WASM and Bazel by _wldu on Tuesday August 11, 2020 @09:14AM (#24119939)
GTK3 and Go work pretty well. Nice article about it here with example code: https://sudonull.com/post/12576-GUI-on-Golang-GTK-3
Re:Golang Desktop App with Webview/Lorca, WASM and Bazel by GrinningFool on Tuesday August 11, 2020 @11:33AM (#24121428)
> With Go the only "possible" way is to write a server and open a tab in your browser.

That split model isn't limited to browser tabs. You can write a nice GUI (native, or tooling of your choice) that communicates with your go back-end via API bindings.

This model is well proven (dockerd/docker cli; various crypto wallets and their front-end UIs, etc), though attention needs to be given to security concerns. Running a local service means malicious software that knows about the service could access it without the user's knowledge if you're not careful, exposing private or sensitive data that the service has access to.

Re:Golang Desktop App with Webview/Lorca, WASM and Bazel by fileeditview on Tuesday August 11, 2020 @12:27PM (#24122178)
I agree that can be a viable solution. Mainly if the backend is also used without GUI. However what I meant is that the Go part of the application will be only the server part.

Can you clarify these security concerns? If the server is only listening on localhost I don't see a difference to "the classic desktop application". If the malicious software has access to your system the data is always endangered right? Or were you talking about services that are exposed to the outside?

Re:Golang Desktop App with Webview/Lorca, WASM and Bazel by GrinningFool on Thursday August 13, 2020 @10:25AM (#24143639)
> However what I meant is that the Go part of the application will be only the server part.

That's what I meant as well. You have a go daemon/service running that does the heavy lifting; and your front end (whatever it may be) knows how to talk to it. The UI elements remain separated from the work of the daemon.

The browser-based/localhost approach works well for this too, but you can also take the same approach for rich/native client apps without having to make the daemon platform-specific.

> If the malicious software has access to your system the data is always endangered right?

This is what I was referring to - nothing new, but IMO worth mentioning in the context of setting up a new service to run on someone's system.

Re:Golang Desktop App with Webview/Lorca, WASM and Bazel by jmnicolas on Tuesday August 11, 2020 @04:14AM (#24118264)
If you want to have a multi platform (desktop) app, the only decent (imo) framework is QT.

So now your app is either GPL or you fork something like 5 grands ...

Re:Golang Desktop App with Webview/Lorca, WASM and Bazel by pkphilip on Tuesday August 11, 2020 @08:53AM (#24119760)
I would argue that Lazarus is a lot better than Go + QT on many counts - including the fact that it is completely free and you don't have to get an expensive QT developer license.

Think Visual Basic but cross-platform, with a much better language and component architecture.

You can develop non-trivial apps in hours rather than days.

The IDE is here: www.lazarus-ide.org

Why Lazarus?

* Has a proper Rapid Application Development (RAD) IDE with visual layout, event handlers, component tool bars etc and also built in documentation

* Extremely fast to develop on: The IDE starts in a couple of seconds. Compilation to native binaries in seconds.

* Cross Platform - Windows, Linux, Mac OS and perhaps even Android

* Binaries are really fast

* Excellent set of visual components

* Excellent set of database components including grids, CRUD toolbars etc

* You can write your own components very easily.

* Very small executable

* Most Delphi documentation is directly usable

* Many existing products use Lazarus https://wiki.freepascal.org/Projects_using_Lazarus

* Demos and projects here: https://www.getlazarus.org/

Re:Golang Desktop App with Webview/Lorca, WASM and Bazel by jchw on Tuesday August 11, 2020 @12:22PM (#24122107)
Lazarus is fine and good, but what does it have to do with writing UIs for Go apps? Can you integrate Delphi/Lazarus code together with Golang code in some meaningful way?
Re:Golang Desktop App with Webview/Lorca, WASM and Bazel by R0b0t1 on Tuesday August 11, 2020 @02:56PM (#24124365)
Yes? It supports different calling conventions. Easiest would be exporting things cdecl from Go. But usually the better way to do this is to write the UI in FreePascal (or something else) and use some form of IPC like pipes or network sockets to get the data to the UI.

I've actually done this, it works well, and the Lazarus GUI libraries manage to get a natural look and feel on all platforms.

Re:Golang Desktop App with Webview/Lorca, WASM and Bazel by UnnoTed on Tuesday August 11, 2020 @05:22PM (#24126140)
Re:Golang Desktop App with Webview/Lorca, WASM and Bazel by fileeditview on Wednesday August 12, 2020 @02:33AM (#24129148)
Wow this looks really interesting.. however it seems kinda risky to start developing a commercial app when the whole documentation is in chinese.. :)
Re:Golang Desktop App with Webview/Lorca, WASM and Bazel by pkphilip on Wednesday August 12, 2020 @02:03AM (#24128992)
Wow! this is good! I didn't even know such a thing existed.

Are you the person who wrote this? if so would like to contribute in some way.

Re:Golang Desktop App with Webview/Lorca, WASM and Bazel by UnnoTed on Wednesday August 12, 2020 @09:40AM (#24131962)
I'm not the one who wrote it, i found it while looking for Nim bindings for Lazarus' LCL.
Re:Golang Desktop App with Webview/Lorca, WASM and Bazel by R0b0t1 on Tuesday August 11, 2020 @05:49PM (#24126435)
That's great. If someone has spent the effort to do that it is worth using.
Re:Golang Desktop App with Webview/Lorca, WASM and Bazel by jchw on Tuesday August 11, 2020 @07:00PM (#24126964)
This is definitely more what I had in mind, awesome!
Re:Golang Desktop App with Webview/Lorca, WASM and Bazel by jmnicolas on Tuesday August 11, 2020 @04:06PM (#24125357)
> Think Visual Basic [...]

I tried it a few years ago and ran away for this exact reason : I have VB PTSD from some complex Excel apps that I inherited at work ;)

But yeah if I was objective I could see a lot of value in Lazarus.

Re:Golang Desktop App with Webview/Lorca, WASM and Bazel by jchw on Tuesday August 11, 2020 @04:23AM (#24118320)
Qt switched to LGPL over a decade ago! So this is not true, even if Qt company tries to make it seem like it is.
Re:Golang Desktop App with Webview/Lorca, WASM and Bazel by millstone on Tuesday August 11, 2020 @04:54AM (#24118486)
If you want to build a good cross platform app, create some shared core and then separate, platform-specific UIs on top of it, using each platform's native capabilities.
Re:Golang Desktop App with Webview/Lorca, WASM and Bazel by tonyedgecombe on Wednesday August 12, 2020 @08:31AM (#24131362)
This is the conclusion I came to after trying various cross platform tools. There is no shortcut to creating a good user interface.
Re:Golang Desktop App with Webview/Lorca, WASM and Bazel by oehtXRwMkIs on Tuesday August 11, 2020 @04:16AM (#24118280)
It's lgpl
Re:Golang Desktop App with Webview/Lorca, WASM and Bazel by pjmlp on Tuesday August 11, 2020 @04:15AM (#24118273)
Yeah, lets not pay the others for the fruits of their labour.
Re:Golang Desktop App with Webview/Lorca, WASM and Bazel by coldtea on Tuesday August 11, 2020 @07:48AM (#24119329)
People don't automatically deserve payment for the "fruits of their labour". Only if you use it and can't find a better/cheaper alternative.

What the parent suggested was not using QT and not paying the company that makes it, but that its price makes it unusable for their purposes.

(Now, that might have been based on a misunderstanding of the licensing involved, but ignoring that, the point still stands. If one had to pay $5000 for a GUI library, and one didn't have $5000, then one could look elsewhere...).

Re:Golang Desktop App with Webview/Lorca, WASM and Bazel by pjmlp on Tuesday August 11, 2020 @08:09AM (#24119457)
Except that look elsewhere seems to be understood as free beer around here.

$5000 is not the price for small developers by the way.

Re:Golang Desktop App with Webview/Lorca, WASM and Bazel by beojan on Tuesday August 11, 2020 @08:29AM (#24119587)
It would be misleading to call Qt the fruits of the labour of (the current) Qt Company.

It is licensed under the LGPL though (however much its current owners may want to change this, they can't because of the KDE Free Qt agreement), which means you don't have to pay. All you have to do is dynamically link to the library instead of statically linking.

Re:Golang Desktop App with Webview/Lorca, WASM and Bazel by pjmlp on Tuesday August 11, 2020 @09:27AM (#24120046)
It is surely more than those leeching Qt for their own projects.

The major contributors for Qt have always been the same regardless of the legal name of Qt owner.

It is quite easy decision process, don't want to pay for Qt's development, use LGPL and GPL variants earn as much money as one is willing to give upstream.

Decide to go commercial, then pay accordingly upstream.

Re:Golang Desktop App with Webview/Lorca, WASM and Bazel by beojan on Wednesday August 12, 2020 @03:05AM (#24129326)
I think you misunderstand me, I think the LGPL is a perfectly good license for Qt and I have little sympathy for those who aren't willing to abide by it (not least because Qt is a rather large library, and there's no excuse for every application to load its own copy).

> Decide to go commercial, then pay accordingly upstream.

Hmm. The commercial license actually prohibits starting development under one of the open source licenses then switching to commercial. If you start under an open source license, you'll need to abide by the LGPL if you decide to go closed source (and of course what you've already released remains open source).

Re:Golang Desktop App with Webview/Lorca, WASM and Bazel by jmnicolas on Tuesday August 11, 2020 @04:41AM (#24118422)
5 grands is twice my yearly disposable income. Yeah let's go into debt for my side projects.
Re:Golang Desktop App with Webview/Lorca, WASM and Bazel by josefx on Tuesday August 11, 2020 @05:22AM (#24118610)
The small business license is $499 and you only have to pay that if you want to statically link against QT without dealing with the LGPL. Dynamic linking Qt is the default, costs $0 and doesn't incur the wrath of the LGPL.
Re:Golang Desktop App with Webview/Lorca, WASM and Bazel by michaelsbradley on Tuesday August 11, 2020 @06:31AM (#24118936)
Static linking also costs $0 if you comply with the terms of the LGPL:

https://www.gnu.org/licenses/gpl-faq.en.html#LGPLStaticVsDyn...

Note that does not necessarily require “your code” to be/come open source.

Re:Golang Desktop App with Webview/Lorca, WASM and Bazel by mmargerum on Tuesday August 11, 2020 @07:25AM (#24119196)
Is that $499 per platform? I'm using Lazarus right now (after QT sticker shock). It's pretty good and free. I rather like object pascal. TMS has a webcore product that runs out of Visual studio (non free) which is also object pascal and generates an html/js SPA. i'm not affiliated with them at all. Just a fan.
Re:Golang Desktop App with Webview/Lorca, WASM and Bazel by josefx on Tuesday August 11, 2020 @08:00AM (#24119406)
Per developer and I think that covers all mobile and desktop platforms.
Re:Golang Desktop App with Webview/Lorca, WASM and Bazel by jmnicolas on Tuesday August 11, 2020 @08:22AM (#24119537)
Thanks, I didn't know that. I looked at QT 4 or 5 years ago and dismissed too quickly apparently.

Wasn't there talks about ending the lgpl version ? I thought I read somewhere that KDE devs were quite worried.

Re:Golang Desktop App with Webview/Lorca, WASM and Bazel by josefx on Tuesday August 11, 2020 @11:12AM (#24121130)
There are agreements with kde that prevent the Qt company from outright dropping free licenses: https://kde.org/community/whatiskde/kdefreeqtfoundation.php

As far as I can tell from that the LGPLv3 seems to be required under the current terms of the agreement.