Qt and Electron are horrible options. What makes modern GUIs so complex that nobody's able to come up with a viable alternative that's simpler, faster and smaller? Whenever I talk to video game programmers, they scoff at the idea that UI is a difficult problem to solve. And they're right. They can get a computer to draw hundreds of complex 3d objects 120 times a second. Why can't we draw some text and a box 60 times a second so my window doesn't skip when I scroll?
GitHub then Microsoft invested heavily into Electron. Tons followed. Not to mention the existing web ecosystem.
There are like two dozen random open source developers who bothered to work on Go GUI libraries, on the side.
It is objectively better than Javascript in many respects, not least of which is performance.
There are only two major blocking issues I see, and none of them is unsurmountable:
- Complex text layout (harfbuzz)
- Accessibility
Battery, for starters. If desktop UIs were all written like games, nobody would carry their laptops anywhere. Because they all be plugged in at home.
The point is not to say "Why don't you guys do GUIs like games where you recompute the whole thing every frame?". Even the people who talk about immediate mode GUI are talking about the API of defining the UI, not the implementation details. It's perfectly consistent to have a GUI library that exposes an immediate mode API but retains a lot of state between frames and only does repainting when necessary.
Also I find this talk about battery life in general disingenious given that more and more tech companies are converging on implementing applications in Electron which drains battery life very quickly.
During my researching, a lot of posts point out that "innediate mode" refers to the API, not the implementation, and that React is effectively a hack to obtain an immediate mode gui on top of retained mode.
Doesn't say anything about performance, just that the implementation behind the scene can retain state to save battery
You have no idea what you're talking about.
I wrote my comment to make it clear for anyone else who doesn't work in this area that what you said is utterly wrong. HN typically has well informed comments so people take it a little more seriously than other places. The thread is also old enough now that no one except you will probably read it.
I'll at least give you something so that you're not left holding nothing but a mean internet comment.
First: If you were to rank the hardest technical challenges in modern computing then UI architecture is easily in the top 5, if not #1. In that same list you have distributed (as in networks) computing. It's an incredibly difficult problem with an endless pit of depth. UI IS HARD. If your next question is "what makes UI hard?" then - good! - you're curious. Take some courses or something. Try building a great UI for non trivial use cases. Educate yourself by doing!
Second: A computer drawing "hundreds of of complex 3d objects 120 times a second" has absolutely nothing to do with complexity of UI. The challenges in UI are not strictly a matter of drawing dots on the screen! The two things are orthogonal! Game engine renderers are solving a very constrained problem whereas UI architecture is totally unconstrained.
Third: Game GUIs have a TINY fraction of the UI components you'd need to support a sophisticated modern day business application (think Salesforce). Someone else mentioned accessibility but that's just the tip of the iceberg. The sheer number of UI components in business applications dwarfs what you see in games. Not only that but the UI components I'm talking about need to be assembled in an uncountable number of ways. And they're constantly being updated/tweaked.
-
There are many people who have devoted their entire life to finding a general purpose way to build great UI. No one has cracked it yet and it's not because people are stupid or don't want to. It's HARD. But also a lot of fun if it's something you enjoy doing.
https://medium.com/swlh/what-makes-godot-engine-great-for-ad...
Accessibility: I'm not well versed on accessibility.
Power Use: mobile games are a thing. I wouldn't be surprised to find out that, on average, mobile games use less battery than electron apps (excluding Unity games. Unity games are the Electron Apps for video games).
cross-platform abstractions like I/O: video games run on more platforms than most apps with a larger variety of I/O and control types.
Regardless, that wasn't my point. My point is that video games are doing much, much more than most desktop apps could ever dream of doing in terms of pure work, and yet things like complex UIs and cross-platform deployments aren't considered difficult problems.
Lol, you’ve pretty much torpedoed any credibility right off the bat.
> Power Use: mobile games are a thing. I wouldn't be surprised to find out that, on average, mobile games use less battery than electron apps
This is a flawed take on multiple levels.
> Regardless, that wasn't my point. My point is that video games are doing much, much more than most desktop apps could ever dream of doing in terms of pure work
This is very hand wavy as to be meaningless. What is “pure work” and how does it have anything to do with architectural complexity? I think you underestimate a lot of of the complexity that goes into the underlying stack of components for desktop applications. If you hand wave away (text) layout, text rendering, accessibility and performance optimization - then you can claim anything.
As already mentioned UIs in games are typically much more limited in scope and complexity.
The renderer itself is abstracted and defaults to opengl 3.3 with a fallback to software rendering as last resort and to be portable.
Long story short: It's not easy but very possible to build a polished cross-platform GUI smaller than 1MB. My app binary currently compiles down to 135 KB on desktop, in the end I aim for less than 2 MB for the whole application.
However I wouldn't recommend this for most applications where a framework would be a faster option for a traditional GUI.
I hope your UI designers are happy with some text wrapping on one platform and not another because they have slightly different metrics even given the same font - for me this has never flown and I had to work to make things pixel-perfect across mac / windows / linux a few times now which definitely does not work when using the platform renderers.
816K /usr/local/opt/freetype/lib/libfreetype.a
1.9M /usr/local/opt/harfbuzz/lib/libharfbuzz.a
2.1M /usr/local/opt/sdl2/lib/libSDL2.a
I don't think people really mind a 20MB executable if it was a self contained application with good performance and UI.
My favourite alternative is probably https://crates.io/crates/conrod-core
That said you generally want widgets that look native in your platform, not some gui that feels like it's been taken out of a videogame.
At its beginning, mobile apps were just a few simple screens mostly querying a server.
It is now closer to the gigantic desktop apps of the 90s (because most have to work offline), except with a much higher quality UX, as well as deep OS interaction (check the list of iOS extensions), AND internet connectivity.
That's why you see things like agent-based concurrency arriving on swift, which is mainly a client-side language.
The Windows API through Delphi was simple and fast 20 years ago. Although the exe would take 400 KB space, so for smaller tasks I would bypass Delphi's stuff and call the Windows functions directly, and create 50 KB sized apps. (the A functions. Guess the Unicode W functions would already double the space)
But on Linux there is no way around Qt. (or Gtk, but the recent Gnome versions are horrible)
Although you could just make the Windows exe and run it through Wine. That is so simple to develop, and for any bug you can blame Wine.
Nowadays I use Lazarus. It is supposed to take the old Delphi code and create a native Windows,Qt,Gtk version from it. For Windows, it creates 2MB exes. Considering that Delphi made smaller files, it must be filling 3/4 of the file with garbage. The Qt,Gtk versions somewhat work, though Wine would probably more reliable
Except Fyne and others… we have a full desktop well underway and some distros are shipping Fyne apps and/or FyneDesk!