I keep looking for alternatives to Electron, which wouldn't require such heavy resources to run, but my searches always seem to come up short. There are a number of solutions that are either dead or are not ready for production yet, such as React NodeGUI[0], Proton Native[1] or react-native-desktop-qt[2].
There's react-native-windows, but I'm not running Windows, and even if that did gain Linux compatibility it seems that they're quite focused on Microsoft-owned platforms.
Is "just stick Chromium into all your apps" seriously the best we can do as an industry? It's resource-inefficient to high heaven, not to mention that it's slow and doesn't integrate with the native platform styles at all. As a JavaScript developer, I'm quite surprised this is the best there is for cross-platform JavaScript development.
[0]: https://github.com/nodegui/react-nodegui [1]: https://proton-native.js.org/ [2]: https://github.com/status-im/react-native-desktop-qt
2: https://fman.io/blog/picking-technologies-for-a-desktop-app-...
https://github.com/tauri-apps/tauri/releases/tag/tauri-v1.0....
[1] https://github.com/c-smile/sciter-js-sdk
Anyway heres some other choices might be viable these days: - Flutter desktop https://flutter.dev/multi-platform/desktop - Jetbrains Compose https://www.jetbrains.com/lp/compose-mpp/
IMO immediate mode guis should be option as well, like imgui, egui. (But afaik you basically throw accessibility out of the window)
Resource usage is a problem but has become manageable over the years. See how pretty and efficient VSCode is. And honestly thank God we have electron, before that a truly cross platform ecosystem was limited to Java and that abomination Adobe AIR.
There are some suggestions, on Mozilla's suggestion platform Mozilla Connect, for turning Gecko into something like Electron[1][2].
In the past, Mozilla ran the Positron project, which was an Electron-like library on Gecko[3].
[1] https://connect.mozilla.org/t5/ideas/create-an-alternative-t...
[2] https://connect.mozilla.org/t5/ideas/ability-to-embed-gecko-...
Yes. What other rendering engine are you going to use? If your answer is anything but a web browser rendering engine, then consider that any serious UI toolkit in 2022 is certainly going to need a WebView UI component: so if you want the WebView UI component to be consistent across platforms (you want this), then you will have to bundle a web rendering engine anyway. In that case, why not just use the web rendering engine as your main rendering engine?
There’s nothing wrong with Electron as a concept. The issue is with either: blink being under optimized for this use case, or bad Electron apps.
Because it's not as easy as it seems to create a proper cross-platform framework. And even if there was an alternative, these days you often need rich text, images, videos, etc. all of which are essentially HTML pages. So you'd end up adding a webview anyway, which is getting quite close to being Electron.
And I think that's the key - why create an "alternative" to Electron if you end up bundling webviews, ffmpeg, libpng and so on. It might be a bit smaller in size than Electron but not enough that it matters.
I would not trust a full browser running on my machine on which I have no control and they can mine whatever telemetry data they want.
Just looking at your 3 examples, I notice they all depend on Qt ... and hence the Qt UI components instead of the more familiar HTML/CSS of Electron.
So the code ends up looking like:
const { QLabel, QMainWindow } = require("@nodegui/nodegui");
const win = new QMainWindow();
const label = new QLabel(win);
label.setText("Hello world");
label.setInlineStyle("color: green; background-color: white;");
win.show();
global.win = win;
So the idea of programmers having to learn a bunch of unfamiliar QXxx() like QLabel() etc -- will be a tough sell to gain mindshare. Yes, it's Javascript instead of C++ but the QXxx() will still create a lot of friction for adoption. Also, a dependency on the Qt framework may be worse than Chromium for various strategy/technical/license reasons.>Is "just stick Chromium into all your apps" seriously the best we can do as an industry? It's resource-inefficient to high heaven,
The complaints about "resource-inefficient" attract a lot of agreement but also ignore the productivity of the developers that get to leverage their existing knowledge of Chromium-based components.
If whatever alternative to Electron has SuperiorResourceEfficientTechnology also comes with unacceptable extra friction (aka learning curve) for adoption, it will then also lose to Electron.
It seems like Chrome OS really had the right idea. Can't we have some cross platform app format that's just a ZIP file full of HTML, with some APIs that go beyond normal web features?
I don't use Linux, but given that Edge also supports this, I suspect that you can do this with Chromium.
I'm not on my computer, but the steps are to hit the hamburger menu, select create shortcut, and then select the checkbox. The words vary, but it's usually something like "run in separate window" or "run as application."
On the other hand I did see a computer with 512MB of RAM in use at a high school in my country in 2018, so I understand that in some places people can't afford to upgrade their hardware.
But if RAM is the only issue and most 15 years old hardware can be upgraded to 8GB or 16GB of RAM for 80€, I believe that most developers simply see problems on 4GB RAM systems as a non-issue.
To get to the non Mac/Linux/Windows end users, Free Pascal is working on a WebAssembly back end, which should allow you to run in a browser. Here's their RoadMap/Status page - https://wiki.freepascal.org/WebAssembly/Roadmap
The main downside is that you don’t get to write your UI in HTML. IME, most Java applications look really ugly, but they run very fast and work well.
Take a look at the wonderful GraderJS, heh :)
In the meantime, no one will bother explore other options, because it just works, even if it's a resource hog.
The good parts
Low barrier to entry - if you know javascript you are good to good. No need to learn C++ or Java for building a desktop app.
Truly cross platform - any platforms that chromium supports, electron supports
A very active ecosystem - The community around electron is amazing. I am a big fan of electron.build, things like code signing / auto updates etc are provided out of the box
The not so good parts
IPC hell
Electron has a main process and renderer process and they communicate via events. I found myself swimming in the event soup very often.
Easy to make mistakes
This is more for a note for me or any beginner, but it is easy to write compute heavy code in the renderer and make the ui unresponsive or sluggish. There are many other things like this where it is easy to do things the wrong way.
Security
Electron still has a capable browser which can open any webpage. Mix that with native access and you have a remote code execution vulnerability on your hands.
Bloated binaries
Even the simplest of the electron binaries are large, thats just the nature of electron.
Shameless plug
The app that I am working on is https://loadjitsu.com, I rewrote it using golang, couldnt be happier.
Both don’t really solve the browser engine thing, but at least Neutralino is much smaller in terms of executable size.
I like the idea you can use any language you want for the backend/system level stuff, though for me that just means more typescript :)
If memory serves, it reuses the OS default web view and any "backend" or system things are done in Rust.
So it took 24 years to get a cross platform rendering engine that was feature rich enough for great desktop apps. Even if we take these learnings, how long till we get a new framework good enough?
Is there a layout engine that performs faster and more flexible?
i don't think many people outside of us technical folk care about electron apps using tons of resources to do what they need to do. (many folks run chrome, for example).
Only what is convenient and fast to do.
---
Alternatives exist, since long time ago. But developers are LAZY. A LOT.
That is why the worst tech that exploit laziness and reward instant gratification (php, js, node, mongo, electron...) survive and get poured millions on effort fighting them, instead of invest is what is better.
Ironically, this kind of tech WASTE money and time like is not tomorrow, but that is for later, and the major effects are not on the laptops of the developers that made it...
The outcome of such push is:
- we do not have anything really cross platform, at least in look&feel terms, there are classic, old, and nearly ignored by most (T)Tk but not much more. Windows have it's own GUI, OSX it's own as well, Qt have derailed long time ago toward a bloated monster with an uncertain future, GTk have derailed since GTk3, and both still do not have a real "native look&feel" on all platforms;
- developers fear having invested a big amount of time and resources on something and then being forced to reinvest time and effort just because at a certain point in time a dependency they used vanish or substantially changing imposing a almost total rewrite of the UI.
WebUI then seems to be the "safest" way to go, at least they can "float" between various platforms as needed and people know them and like their colored style... However chosen a classic local server for a localhost webapp is longer than just grabbing something already made and then...
IMVHO the real alternative is say STOP. Witch means for now ok-ish to develop locally served WebUIs or classic Tk/fltk/OpenGL (depending on the kind of GUI) but certainly not in the Electron/node sauce, only the UI and as much detached as possible from the core logic for the narrow target. For the broad target push back toward a real desktop model. Push networked applications that are not web thing, like pushing again emails with a local MUA, not a webmail, a local maildir not on a remote IMAP, locally indexed to have GMail like search (notmuch/mu for instance), file sharing apps like SyncThing/Retroshare, Jami for audio/video communications etc.