I’ve seen people defend electron, talk about core logic in a cross platform language and native gui code and any number of other options.
As a middle of the road developer I think it’s difficult to find any consensus (besides electron being both simple and hated).
What resources are there for building quality, functional cross platform desktop application?
1) Buy a basic HTML template online for your app's dashboard.
2) Don't use Electon. Your users WILL notice and complain about performance. Instead, use the native WebBrowser control in .NET for Windows and WebView using macOS to display your UI. Disable right clicking and highlighting using HTML/JS. To the user, it'll feel like any other native app. Add this meta tag to the HTML file to ensure the WebBrowser control knows to use new versions of IE to render the UI: (and/or look up how to add the FEATURE_BROWSER_EMULATION registry key)
3) Use the built in script calling functions to transfer settings back and forth between the UI and main app in JSON. Do the back end stuff in native code.
4) You can then re-use most of the UI code you wrote to easily port over to macOS. Use the same functions and logic you wrote on Windows to make your Swift functions.
* I've been making a living from building/maintaining my desktop application for about 5 years and had no regrets setting it up this way. I've also seen a number of other expensive, high-end, "professional" software using the FEATURE_BROWSER_EMULATION registry key trick.
Good luck!
1. Sciter
- Languages: C++/Python/Go/Rust/Pascal (optional: HTML/CSS/tiscript)
- Development time: fast
- Resource usage: light (space and performance)
- Visual customization: easy, doesn't use native widgets.
2. Qt
- Languages: C++/Python (optional: CSS/JS/QML)
- Development time: slow
- Resource usage: quite heavy (space), but well performant
- Visual customization: QtWidgets: hard, QML: easy, doesn't use native widgets.
3. WxWidgets
- Languages: C++/Python
- Development time: slow
- Resource usage: light (space and performance)
- Visual customization: hard, uses native widgets.
4. Lazarus
- Languages: Pascal
- Development time: slow
- Resource usage: light (space and performance)
- Visual customization: hard, uses native widgets.
[1]: https://sciter.com/ - https://quark.sciter.com/
[2]: https://www.qt.io/
Even if you're not legally required to implement it now, and even if you don't think this is a basic human right (which you should), there are legal changes coming, and you never know when you will be forced to implement it.
If you choose a library with great accessibility support, even though your app might not be accessible initially, fixing this won't be that hard. If you choose a library without one, though, when the time comes, you will either need to completely rewrite your app using a different library, or dig deep into native OS code and figure out how to interface with accessibility APIs, which is not an easy task.
This is a risk/reward scenario. The downside of choosing a library that supports accessibility usually isn't that bad, putting personal feelings about Electron aside. However, if you need accessibility someday, however unlikely that might now seem, you really don't want to be forced to drop everything and focus on rewriting that GUI layer fast, before the regulators catch you.
It seemed very unlikely that game developers would ever need accessibility, so no one cared. Then, the US government mandated that all chat systems must be accessible, and a lot of games include chat systems. That was not a pleasant experience for anyone. You never know what is coming, and you don't want to shoot yourself in the foot.
Now for some pointers. Electron is fine. No, really, Electron, is, fine. There's nothing wrong with it. QT is fine too. GTK works, as long as all your users are on Linux, as accessibility for other platforms is nonexistent. Java works on Windows, not sure about Linux and Mac. Anything that uses native widgets, so WX and native OS frameworks are the best, but not everyone can afford the luxury of choosing those. Game frameworks and small, minimal libraries are a no go.
Why?
1. Cross platform - Mac OS, Linux and Window and Raspberry Pi https://www.lazarus-ide.org/
2. VERY fast development and compile-run cycles. You are talking about WYSIWYG designer and compilation in seconds.
3. Fully native binaries which are very small and very fast.
4. It is a full fledged RAD environment with full support for GUI development using a very powerful designer.
5. There are GUI as well as non-GUI components - example: Database components, Database-aware grids, database aware-listboxes, search filters etc.
6. Very diverse set of components. And very easy to develop new components from scratch or customise and existing component.
7. The object structure is very powerful - with support for read & write properties, composite components, property setting pages, internationalisation etc.
8. It is possible to interface with C/C++ libraries as well and that isn't complicated
I wrote a little framework for this: https://github.com/jdarpinian/web-ui-skeleton
Sounds like you already know the big players so I won't repeat them. Instead, here are some off-kilter ideas:
1. Casual use, general interest, notification-requiring, simple single-file data requirements, tolerant of desktop / mobile split sessions? Try making a chat bot for Telegram, FB, Discord, Slack..
2. Dynamic, visualization-focused UI with simple options that need to be tweaked interactively? Try Imgui[0] or Godot[1]
3. Scientific or data-centric stuff pulling in data from here and there, but meant for interactive exploration? Try Wolfram / Mathematica or an IPython notebook / GoogleColab
[0] https://github.com/ocornut/imgui/wiki/Software-using-dear-im...
[1] https://medium.com/swlh/what-makes-godot-engine-great-for-ad...
1. design things using an MVVM pattern and share all your business logic
2. write all your native gui code manually as you tease out the patterns
3. over time, you can start moving the UI generation into the shared code by writing a custom DSL
The problem with platforms like React.Native and Elecron is that they are based on having a JS runtime, which is a de-facto performance hit and forces an async communication flow to the "native" side (flutter also has this issue). Xamarin does not have that same restriction, and is my preferred framework for this. Xamarin.Native (aka Xamarin.iOS/Xamarin.Android aka Xamarin.Traditional aka Xamarin) has a very minimal performance overhead for what it gives you in terms of native bindings and a shared codebase. Xamarin.Forms is a higher level abstraction that sits on top of Xamarin.Native and lets you theoretically write 100% shared code (by essentially being a community developed UI DSL like I outline in step 3 above), but it is buggy and has much worse performance.
The hardest problems you will have to solve using this approach are navigation and lifecycle. For the most part these are well understood issues and you will find lots of postings with different strategies on how to approach them.
As a Mac user I prefer native applications if available. But still, I would consider a well-written Qt application.
For example, qBittorrent is quite alright.
If you want to go the route of running a server on the user's machine and serving it through the user's browser, ClojureScript and Reagent/Re-Frame are excellent choices. Re-Frame, https://github.com/Day8/re-frame, in particular has very nice documentation.
Clojure lets you use anything in the Java universe while ClojureScript gives you access to all the JavaScript stuff, including Node.
There is a lot of tutorial information for both languages.
It's slow to render? Wrong, Electron (Chromium) renders faster than Qt. The Skia engine is optimized to an extent that these other toolkits cannot compete with. It even has a Vulkan backend now.
Single threaded? The render process is--you can use any native multithreaded code you want in another process.
Memory? It's 70MB. That's nothing nowadays. Modern OSes can page it in and out when the application is idling. A lot of these other toolkits are quite heavy too, especially JavaFX in my experience. Also what happens when you need a webview in one of these other toolkits? In Qt you get an embedded instance of Chromium[1] so not only do you have the 70MB of Chromium, you also have the Qt runtime (!).
The reason the Electron app you're using is slow or hogs giants amount of memory is the Javascript code itself is slow. Yes, Slack is a slow monster, but it's a giant codebase that does things that would be simply impossible in Qt, GTK, Swing and others. There's a reason we never saw these types of apps when the only frameworks were Qt and others.
In a sane world we would already have webviews on all platforms and the problem mostly solved for client applications. But there's a lot of forces at work that want to artificially suppress web UI. Chromium doesn't have webview on desktop platforms, but Microsoft's chromium edge does. Apple puts in their special restrictions making up rules for any app that uses wkwebview.
Nobody with the power wants to make webUI universally deployable.
At the end of the day you choose one that you'll actually deploy something with. There's no more right or wrong in UI, it's can you get to the goal of deploying a functional app or not.
There are thousands of hours of video tutorials on how to build cross platform apps with FireMonkey on YouTube. But really it is just all built into the IDE. Select the platform. Compile. A Linux machine and a macOS machine are required to compile for those platforms. Because it is an integrated IDE everyone is together so there is less tooling to fight to compile for all platforms.
Plus Delphi has staying power and plenty of history (25 years) behind it just like Python and PHP (verses newer languages and frameworks which may not be around later).
There are other libraries available for Delphi that let you build apps like Electron (webview based apps) or entirely using native controls on iOS using Storyboards if you prefer that way.
If I can self promote for a second here are 100 cross platform sample apps built in Delphi: https://github.com/FMXExpress/Cross-Platform-Samples
When people criticize Electron, I don't think they're saying "given your capacity, you should have picked a different and better point on the tradeoff curve". I think they're just mad that you had the requirements you had and didn't get to apply more resources than you had access to.
So, at first it sounds like they're making a technical argument against anyone who would choose to use Electron, but I think what they're actually doing is instead expressing some kind of economic disappointment in your situation.
(I would probably use Electron on a small budget, Qt on a medium budget, and native apps on a large budget.)
My constraints were:
- I'm not starting a desktop application project in C++ today.
- I don't want to do the heavy lifting for complicated widgets myself.
- I want to have the performance of compiled code without concurrency limitations (so no Python or Ruby).
- I want at least a reasonable facsimile of native look'n'feel on the three major desktop platforms.
- I want accessibility as at least an option.
If I don't want to buy dev tools like LispWorks or Delphi, then I'm left looking at Java + Swing or a backend in Java or .NET and a web frontend.
Then I look at Dolphin Smalltalk or Corman Lisp which are now open source on Windows, and they're phenomenal development environments that target Win32 directly instead of the layers added above it. macOS has excellent dev tools for just macOS. On Linux, GNOME and KDE both provide excellent environments. And I wonder if I should just forget about it and pick a platform.
https://github.com/wxWidgets/wxWidgets
runs native on the following platforms:
- wxGTK: The recommended port for Linux and other Unix variants, using GTK+ version 2.6 or higher.
- wxMSW: The port for 32-bit and 64-bit Windows variants including Windows XP, Vista, 7, 8 and 10.
- wxOSX/Cocoa: For delivering 32-bit and 64-bit Cocoa-based applications on macOS 10.7 and above.
- wxQt: wxQt is a port of wxWidgets using Qt libraries. It requires Qt 5 or later.
- wxX11: A port for Linux and Unix variants targetting X11 displays using a generic widget set.
- wxMotif: A port for Linux and Unix variants using OpenMotif or Lesstif widget sets.
Bindings are available for C++ and python
Window Layout Using Sizers
Device Contexts (along with pens, brushes and fonts)
Comprehensive Event Handling System
HTML Help Viewer
Sound and Video Playback
Unicode and Internationalization Support
Document/View Architecture
Printing Archiecture
Sockets
Multithreading
File and Directory Manipulation
Online and Context-Sensitive Help
HTML Rendering
Basic Containers
Image Loading, Saving, Drawing and Manipulation
Date-Time Library and Timers
Error Handling
Clipboard and Drag-and-Drop
I'm in a position where I'd like to develop a better client for Bitwarden that includes autofill to the point of 1Password, and while I did start with GTK (learning for the first time), seeing no one recommend GTK here (compared to multiple people recommending Qt) isn't filling me with confidence
I've seen some tutorial some time ago, where someone used libwebkit from Rust, but I could not find it again recently, so the point is: There could be libraries allowing you to talk to a rendering engine and this could be a more mInimalistic approach than Electron.
What I’m more looking for are specific resources on how to do it. Like say I choose qt, what then? How do I go from an idea to a cross platform app with a reasonable build pipeline and a clear method for installation?
Another option is to look into Flutter. There are many available iterations for desktop applications, one of them is the go-flutter[1].
So imho I would compromise and make an app that bundles a web server. So you separate out the hw logic from the GUI with an internal API and then bundle a web server to host the apps web GUI, and have it talk directly to the HW using the apps internal API.
That way you get the wide range of ecosystems available for building web based apps, while also talking directly to hw with your internal API components.
Here are our key learnings :
* Building desktop apps is made up of an ecosystem which has sub optimal tools and it is very likely that it will never get better. On one end there is Electron which makes it easy to build but then if its a trivial app and your users are not likely to 've faster machines - your users are likely to suffer. Chrome the culprit is pretty much a joke. And on the other end there is QT, GTK which are awful to say the least.
* More than building, it is the publishing these apps that is painful which gets rarely discussed here. It costs you both time and money. By time, on how bureaucratic the process is involved in procuring the SSL from a licensed vendor, its verification and so on. And money to get the code signing licenses which are separate for both MAC and windows. And good luck publishing them without code signing - apss will be treated like malware by OS. However popular apps still go ahead and do this (notepad++ etc)
I would say use electron if you do not have sufficient resources to build natively for every OS. With some webpack optimizations you can squeeze in the app size to less than 300 MB but many electron apps without these optimizations go upto 650+ MB. Or else build it for MAC/Windows - release and see your adoption and take the next step.
The ram usage is going to be higher than a native app, and so is the exe size. Those issues can’t be comparable. but the performance of the electron itself is not so poor as people believe. And a well written electron app can easily use under 200mb of ram, which is not an outrageous amount on modern systems.
It basically lets you compile WinUI (Windows 10, C#, XAML) apps to run natively on all platforms (Windows, MacOS, Linux, Web, iOS, Android).
Disclaimer: I was part of that project for 3 years.
Alternatively you could use a compatibility version of OpenGL, like 3.3 which will run on any desktop OS, then use a windowing lib like glfw and UI framework like Dear ImGui which is graphics API agnostic. I use this particular combination all the time and it never lets me down. Sokol is another options which is a very thin layer over many graphics APIs.
They are using it to build Onivim 2[2] so they are _very_ committed to making improvements.
[1] https://www.outrunlabs.com/revery/ [2] https://onivim.github.io/
A Drawing application, where the 'core' is the drawing/filter/etc code, should probably be done in a shared library (C/C++/Rust?) and then have a native UI as the UI won't be the complicated thing.
A Video editing app (where the UI for timelines, etc etc) where the UI is quite important, should probably be a mix where generic stuff (menus, buttons) use the native libs, but then have most of their controls rendered independently of the native UI lib (timeline, custom controls, etc).
A audio mixer where the UI is mostly all custom, you can even do it in Unity (or Gogot/OpenGL/whatever) as 95% of it will be custom.
A 'show data' ui filled with tables and lists and the likes, while I don't like, probably something like Electron would work. Or QT/wxWidgets
A game pretty much doesn't matter and use a game engine that is supported in all platforms.
I would recommend to use something like QT/wxWidgets/Xamarin Forms/etc as a generic take all, and depending on the app, adapt it to your needs.
However I’m currently planning a project that has a game in a main window and separate debug windows. The main window will be OpenGL, but I don’t know whether there’s an advantage to using Qt for the debug windows, compared to using OpenGL throughout with Dear ImGui on top.
As a user I expect applications to stylistically conform well to the native UI rules. I want a Mac application to look and feel like a Mac application, and an Android app to look and feel like an Android app. When an application uses one of these "cross-platform toolkits" I can tell instantly by using the application for a few seconds. Odd things around scrolling, menus, mouse hovering, how things re-draw when you resize the window, etc. They make your toolkit-built app stick out like a sore thumb. Yuck! Some toolkits are better than others, but I'm pretty sure I can always tell!
Sacrifice a little to do your users a favor: Build all the business logic cross-platform, with an API layer callable by whatever the best native language is, and do the UI portions of your application with the platform-recommended native tools.
This produces a superior (often vastly superior) result, and it's also very hard and time-consuming.
As an example: for Apple platforms only, SwiftUI can enable you to write a high-quality macOS/iOS/iPadOS app, but the devil is in the platform-specific details and exceptions to the generic behavior. Even Apple doesn't do a great job with some of its own cross-platform apps, and that should tell you that it isn't easy and doesn't come for free.
Now consider the effort to get that level of performance, usability, and platform integration in a "non-native" framework that also targets Linux/Windows/Android/etc..
There’s also these tiny but high-quality frameworks for C++: https://github.com/andlabs/libui https://github.com/cycfi/elements
Needs a target machine to build the output executables, but other than that, it's great!
A PWA that opens as its own Chrome "window", but shares resources, and runs any non-ui code in a web worker or localhost server, might make sense. But I don't know how to have a nice "install" experience that doesn't make it feel like a second-class-citizen Chrome app.
Is there a way for a desktop installer to install a chrome app, such that to a typical user it just feels like Any Other Desktop App?
Mono renders the app UI really well, but it's not pixel accurate - in fact, I found all the widgets to be stretched horizontally by an extra 10%. To confirm it, I put a circular image on the form, compiled it, and ran it in Mono (Rasbian distro) and the circular image was rendered by Mono as a squished oval. Otherwise it's a fairly good solution.
For example, [NetBeans platform](https://netbeans.org/features/platform/) provides a very high quality platform to build Swing-based applications on top of. [Eclipse](https://projects.eclipse.org/projects/eclipse.platform) offers something similar. Both of those use Java.
If you would prefer something more "lispy", you can do just about anything on top of [Emacs](https://www.gnu.org/software/emacs/) (with the possible exception of making it pretty.)
Depending on your application and familiarity with the IDE, using the base under one of these (or other) IDEs could save you tons of time.
I have a Java application that was built in 1999, still works on Mac, Linux, and Windows. I have built some JavaFX apps, but they have had problems rendering on some machines, so I have abandon that avenue. Besides it appears to be designed for the web, and was just a pain for layouts.
For years I have been working a Java framework that allows for quick building of basic applications. The framework comes with database access, SQLite included, and a deployments and what is now called package management.
lindyFrame http://dandymadeproductions.com/projects/lindyFrame/lindyFra... https://github.com/danap/lindyframe
In the 1990s there used to be something called Visix Galaxy. The GUI builder was the best I’ve ever seen. It was amazing but cost $$$.
Have folks used it? Is it any good?
The Kivy ecosystem offers many neat things like PyJNIus to access Java class (and thus Android API) from Python, or Plyer for high level cross platform access to features like notification, vibration or GPS.
An other uncommon choice which can be interesting (and has been discussed recently here), is using Godot for UI.
So I'd start by asking yourself whether you really need your application to be cross platform.
https://www.red-lang.org/2016/03/060-red-gui-system.html
Can’t say I like all technical decision they made. I would prefer them to use a purposely-built GPU-centric renderer instead of Skia, it’s not terribly complex, here’s a proof of concept: https://github.com/const-me/Vrmac/#2d-graphics Still, Skia is not _that_ bad, maybe it’s fine there.
But man, the balkanization of OS GUIs and widgets should have been subjected to the same very public shame that IE6 was subjected to, and a standards body.
No wonder electron is so appealing.
There is no technical excuse for modern OS's to have converged on a very well designed crossplatform UI toolkit. It really does underlie so much of why people are fleeing desktop OSs for phones and tablets.
Does Microsoft Office still bake their entire own Windows UI/Widget stack?
If you want all the bells and whistles, go for Pharo. If you are planning for something functional but simple, cuis smalltalk is the way to go.
If you want a RAD IDE I recommend you to take a look at Lazarus and Xojo ($).
You can try them all and think for yourself. Xojo and LispWorks in particular come with plenty of example apps.
There’s also FuncUI, an elm-like layer over Avalonia written in F#.
Something I've been struggling with is choosing a UI platform with a drag-and-drop editor for most UI frameworks. This available in Lazarus and Visual Studios but that's about it. Nothing works well in the Java/C/Python space with a visual editor.
Why is that? Do people not find visual editors useful?
If I need it, I'd go with a webapp, preferably Blazor for wasm. For native, I'd want to use one of my preferred platforms. Windows10 for desktop, iOS for mobile.
I'd work my way down, starting with what I'd prefer to work with most.
1. Blazor WebAssembly (webapp)
2. Blazor Server (webapp)
4. WinUI/UWP (native)
3. ASP.NET MVC (webapp)
5. iOS (native)
wxWidgets (C++) / wxPython (Python) Qt (C++) / PyQT (Python)
Mike Driscoll has a recent ebook on wxPython that is a good jumpstart if you are familiar with Python. There are a host of other resources for Qt/PyQt available via Google.
You can, of course, use any of the NodeJS frameworks as well. In the absence of any clear requirements, any of these will work.
Sounds exciting, no idea how far along it is. Hadn't heard of it until today.
It looks like a good alternative to Electron but haven't tried. Anyone?
For top tier heirloom quality, use the native GUI widgets of the platforms you are targeting. The rest written in portable C.
If the app is literally just GUI widgets, then then the cross platform nature falls apart. But for something like a 3D video game where a window widget is just a little bootstrap to your game, it's nice.
There are 3 general approaches:
* Web technologies (Electron or any WebView) * Wrappers (eg. react-native, Xamarin) * Using a cross platform framework with some UI code (or additional UI renderer). (eg. cpp: QT, JUCE; java: swing or the newer ui toolkits).
In terms of performance, The major question is the impact of the UI.
Are you in need for video? do you need super-awesome FPS with custom GPU shaders?
If you need super-fine control on the entire UI, meaning, the app IS the UI :) (or at least it's a major part of it) - then writing close to metal (OpenGL --> Vulkan/Metal) might be the best starting point.
If your app can also run in a web-browser without compromises then starting a web-based development would be best.
TL;DR - I feel that there's need to scope the UI needs to decide which is best.
Although I've not yet tried it myself, there's AndroWish (https://www.androwish.org/home/home). Deploy your TCL/Tk code on Android with minimal changes.
The complaint that it looks old-fashioned is addressed partly by using ttk (themed tk) but also just about every aspect of the widgets can be styled using a simple xresources-style config.
It's fast and lightweight, free forever, stable as hell, and there's lots of resources online.
If you're careful, you could build something which works on every desktop starting with mid-1990s.
For newer platforms, if you want it to be a "true desktop app", you could bundle the HTTP server. Whatever your platform, there are many options.