On the business side, I understand that many people on HN prefer to ship that spend time on technologies discussions.
But if you have the time, and your goal is to do something maintainable, reasonably close the most to the Desktop, and well-integrated to the OS, what tech/stack will you use?
Windows/Linux GTK/MacOS
I think the mess we're in with GUIs is because we've failed to find a way to convey at a very high level what the inputs and outputs of software are. In a utopian world, you'd define what you want the user to see and how the user can interact with the information. Something would then work out how to lay that for you (in a way that makes sense to a human) and construct a GUI using native OS APIs.
Instead, we have only three options that I'm aware of:
* Use a framework that ignores the native APIs, throws away the OS design language and does all the rendering inside
* Build separate applications for each platform
* Use Electron and potentially reuse work you already did on the web version
When looking at it this way, it's easy to see why Electron is popular. Not that I'm a fan of it in any way.
I think what we need is a lot of really smart people to come together to reinvent the presentation layer.
RAD Studio 11 just got released and allows native development for "all platforms" from a single codebase and GUI at the click of a button. [0]
I have ranted about and harshly criticised Embarcadero's misguided product policies as much as the next guy but that doesn't change the fact that Delphi is still the most mature and versatile Rapid (sic) Application Development environment out there, especially if UX and UI are important to you.
And the twenty-year old adage that you can knock out an MVP with a really nice and polished GUI in a Saturday afternoon is now even more true than ever.
In the end, a native binary with a small footprint (easily 1/100th the size of an Electron project) will fall out at the press of the F9 key and that's really something to behold...
The free Delphi community edition [1] might even offer all the features that you need, although I really wish Embarcadero would see the light already and sync its release cycle with the full version.
Delphi might not officially be regarded as hip or cool these days (mostly due to severely and ongoing errant product and community management by the company that makes it) but some great people and brilliant minds are associated with it and compared to the olden days Delphi is now somewhat of a secret underground Swiss army knife that ironically gets used now mainly in big and medium corporations.
I like to think its versatility combined with the fact that it's technically uncool and against the mainstream to do projects in Delphi these days might fit a hacker's (and HN user's) mindset very well...
[0] https://www.embarcadero.com
[1] https://www.embarcadero.com/products/delphi/starter?aldSet=e...
Qt [1]
The main codebase is C++, but bindings are available for Python and several other languages. I have developed and shipped multiple cross-platorm applications using Qt, using both C++ and Python. Documentation and source code examples are readily available.
JUCE [2]
Another C++ framework, with Python bindings. The focus is on music and audio apps, but a cross-platform GUI framework is also part of the library.
Blazor Desktop [3]
I have developed C# web applications using Blazor and WASM and moved them to the desktop easily. Using C# and the Dotnet ecosystem is really interesing and worth looking at.
Flutter for Desktop [4]
Still in beta, but has the support of Google, for better or worse.
JavaFX [5]
A Java cross-platform still under active development. I think it is pretty nice if you like Java.
Red [6]
Let's add an outsider just to keep things interesting!
This github site seems somewhat current about other Electron alternatives as well. [7]
Good luck! You will find there are lots of alternatives out there.
[3] https://visualstudiomagazine.com/articles/2021/02 /17/net-6-preview-1.aspx
[4] https://flutter.dev/desktop
Cross platform done right (native code, no intepreter, no VM). Both IDE and generated code run native just about everywhere, from small ARM boards to virtual machines, and of course x86. As fast as C, decent sized executables, lots of built in or available libraries and components to do a lot of things, from managing databases to low level access to hardware, graphics, sound, etc. And of course it's 100% FOSS.
My last use case was a few years ago when a friend needed to monitor some security cameras, but they were of different brands and needed either their crappy Android/iOS app or a even more crappy XP-only ActiveX control on Internet Explorer, while he wanted to monitor them from a single screen on a Windows 7 PC. As soon as I discovered the right URL for each one to grab their video feed, I arranged a window container in Lazarus dropping there a bunch of media player components, each one linking to a camera, a few other controls and bingo, he could fire up the application and have the mutiple camera view on a monitor.
If it compiled more modern languages such as Nim, Rust or Crystal it would be perfect, but even by current standards Object Pascal it's still really powerful.
https://wiki.lazarus.freepascal.org/Screenshots
I've probably written GUI apps in C, Java, Ruby, Objective-C, Swift, JavaScript, and probably a couple I forgot about. Dart+Flutter come the closest to being "good" and correct. There's some missing documentation for Desktop development with regards to Flutter + Dart but nothing is totally intractable if you're willing to read through issues. My only caveat is that Google is truly an awful company to depend on for your business; since, they 100% do not give a a single fuck about you unless you're paying them ~$100 million or more a year, or an EXTREMELY high profile client.
I've been getting ready to give Pascal a solid try but I still totally lose my mind when working in Lazarus (like where did the thing I just used go? Ah yes, tiny, free-floating window, of course). I have a feeling Pascal is probably the real diamond in the rough of UI application development these days.
Qt is probably fine but their licensing turns me off from ever using or considering it.
It's open source, the code has always felt reasonably clean to me, and it gives your apps native look and feel.
> Free and open source: https://www.lazarus-ide.org/index.php
> Other 30+ cross-platform GUI toolkits / frameworks: https://www.slant.co/topics/983/~best-cross-platform-gui-too...
Lazarus has the opposite problem of all the other UI toolkits - relatively awesome UI across all platforms (especially if you're a fan of WinForms) but stuck with only support for Pascal.
However, keep in mind that desktop apps have the major disadvantage of figuring out distribution (separately for each platform!!), which includes the following two steps: 1) packaging the application in some format (e.g. an MSI installer for Windows and a Disk Image Bundle for macOS), and 2) distributing that package (including auto-updates). I have written a number of articles about this topic, see https://www.augmentedmind.de/2021/05/30/distributing-windows... and https://www.augmentedmind.de/2021/06/13/distributing-macos-a... . You get rid of all that if you just built a PWA or other kind of web app.
In addition, if you use Python, you also need to choose a "freezing" solution, such as PyInstaller (more details at https://www.augmentedmind.de/2021/05/16/distribute-python-ap... ).
The platform abstraction code is here: https://github.com/solvespace/solvespace/tree/master/src/pla...
There is no other platform specific code anywhere in the app, but like I said above we don't support widgets.
There is also an emscripten port in a branch, but it doesn't want to build recently.
There's a decent GUI markup editor (Scene Builder). There's no need to manually connect your handlers from XML markup to code - you can use annotations for that. There's HiDPI scaling that you can override if need be. There are Observable properties that you can bind to each other.
It's nice! Canvas and DrawingContext are a bit of a pain to use for my specific use-case, since it draws straight to buffer with no underlying Image, but I make do for now.
And you can take advantage of jlink to trim your JDK to modest sizes. There are also tools like Graal Native and Liberica Native Image Kit to compile your Java app down to binary, but I haven't toyed with those yet.
The cons are obvious: non-native look (you can try to style it with CSS, but there are no ready-made native looking solutions, I think, only different themes) and JVM startup time.
However, if you're willing to write C++, I'd argue Qt is the best choice right now. I just refuse to touch C/C++ with a ten-foot pole
There’s really 3 choices that I see, and have done all of them:
1) just build native UIs for each platform. This is the most time consuming, but the best end result in my opinion. The apps _feel_ the best on each platform
2) make a web app. Electron apps are still web apps.
3) hybrid approach, where part of your logic is shared across different native UIs, let’s say with a C++ / Rust / Java / Kotlin library. This is also a spectrum. Your library can just have common glue / networking code, all the way up to drawing its own graphics before turning a full screen over to the native UI framework.
I guess there’s also 4, which is Flutter, but that’s really just a pre-packaged #3.
If you ask me, web just has the best delivery model, and that trumps everything. Responsive web app plus a native option via Electron is the way to go.
You mentioned getting data to a GUI application using the web, this seemed like an ideal small project that could give you a firmer idea of just how Lazarus might fit your needs.
Notes:
I've never done anything like this (https/json) before but I suspect I'll be done in a day or two. Once it works, I'll then focus on getting it to also run in Ubuntu. I don't have a Macintosh, so that's out.
I've GPL 3.0 licensed it.
I'm not near the MVP yet, but it does manage to fetch the data and count the JSON objects in it for the main body of this thread.
With Debug info, the windows executable is 25 megabytes, without it 3.1 megabytes.
Here's the github link: https://github.com/mikewarot/WatchHN
Electron: Bloat, non-native, highly questionable language
Other cross-platform solutions: Obscure, (most often) non-native, undesirable language constraints, often far behind with regards to UI paradigms
Native UI for each platform with common code: requires deep knowledge of each platform, probably more time consuming than the other alternatives, the seam between common code and platform-specific code is often a source of errors
Fully separated native applications: Likely to produce the highest quality UIs, but requires the most diverse knowledge and time, more difficult to remain consistent across implementations, team size becomes an issue depending on how many platforms are supported
As much as I dislike Electron-applications, it's understandable why they became adopted so widely - the alternatives are just quite simply not great.
If the app has a whole lot of dense UI screens, or if you don't particularly care about it looking nice and feeling platform native, something like Qt or many of the other frameworks suggested here work well, but do be aware that you'll be making it harder to use platform features. For example, on MacOS you wouldn't support the TouchBar and would have some extra complexity to support Metal graphics vs GL (which Qt supports).
You can also do something similar to Electron but much more lightweight using a platform WebView. Then you can have common controls built in a htmlish way, and still have custom and native controls mixed in. One example of an app I worked on that was built this way and worked well was an app to browse/view 100s of video clips, we had a common html-based widget to filter and display search results and thumbnails (which had a bunch of interesting layout requirements) but the video playback itself was in a native panel (it needed to play custom formats so using web for everything wasn't appropriate).
Flutter looks promising but it still feels a little early. Try it out if you're willing to take some risks and maybe bend your thinking a bit. I found it too indirect and felt like I had to give up too much design responsibility to the toolkit when I last tried it but maybe that's an advantage.
If you're thinking about Electron, why not make it a purely web app? Then you'll save yourself lots of hassles distributing and downloading.
Also, for graphically intensive or in-house tools (like a game level editor) i use Dear ImGui, it's very fast to develop and great cross platform support, but I wouldn't ship it to a customer.
Unfortunately, "well-integrated" and "cross-platform" are fairly mutually exclusive, kind of by definition. I'm not sure if the API model for Windows and macOS even have a generalizeable common model. (They might, they might not, I've not investigated, and it would depend on which of the many MS UI APIs you are using)
To me it makes sense from tne perspective of the work being done in HTML, CSS & JS to make an Electron app. Why not start as a website then desktop?
I get there are certain pieces of functionality not suited for a website; but based on the original post’s question and description it seems feasible.
We have a suite of framework-specific developer apps for tasks like packaging deployments, managing common database tasks, onboarding new clients etc. They were written on Linux using Lazarus, then recompiled on MacOS and Windows as required. There are occasionally OS-specific variations for small pieces of these apps, but Object Pascal has inline compiler switches to make this easy to manage.
Their roadmap include, in some years I suspect, probably 5, to also target WASM at which point, if Embarcadero is smart enough to lower their ridiculous license pricing to under $300, will become the most powerful tool to write cross-platform applications.
The .NET ecosystem is another solid choice for cross-platform desktop app development (and nowadays even mobile, too). Avalonia² in particular looks promising, and is probably what I'd try using first should I ever be tasked with developing a desktop app again.
EDIT: Also, since you mentioned it already for Linux, GTK works well enough on Windows and (IIRC) macOS, too.
----
Something that was mostly native for all of them.
Currently the only alternative to Electron that is similar is a program that hosts a local webserver and the local browser is pointed at it, but that's a second class experience.
That said, QML and QtPython sound like a really great combo
It worked but the amount of effort is not worth it for most organisations.