logo TeddyDD

How to Kill Electron

Electron sucks. I mean, from a developer’s perspective, it’s better than cross-platform GUI toolkits like Qt or Gtk. It offers better tooling, reactive programming, and no need to use C++…

However, Electron is quite resource-heavy. The binaries are hundreds of MBs, and the memory usage is even worse.

Here’s an idea: since users already have a browser installed, why not use it?

Before you say, ‘But that’s a platform webview, duh,’ let me remind you that on Linux, webview uses WebKit, on Mac it’s Safari, and if you’re unlucky, you’ll get Edge or Internet Explorer on Windows. Nobody wants to target garbage browsers.

Another problem with webview is that you need to interface with the platform’s API (usually C). I want to write GUI in shell script or Lua or whatever.

So here’s the idea: browsers should support a new CLI flag. Let’s call it --webui <PROFILE-DIRECTORY> or whatever.

The flag does the following things:

That’s all.

Additionally, browsers could learn to communicate with an HTTP server via a UNIX socket instead of a TCP port. But that’s optional. (Do they even have sockets on Windows? 🤔).

There is a project on GitHub that tries to achieve that: webui. It kinda works but requires unholy hacks. Would be nice to have one, „do what I mean” flag in all browsers.