16 ms·
Rust GUI ecosystem overview
- cosarara 7y agoWhen it says gtk is "really really ugly", is it referring to API or UI? I wrote a small app with it and I am happy with the result. https://github.com/cosarara/fucking-weeb https://github.com/cosarara/fucking-weeb
- megous 7y agoGtk+ also has a lot of thrid party components. They may not be that discoverable, though. But you can look through a typical deps of a GNOME distribution to find some.
- blattimwind 7y ago> When it says gtk is "really really ugly", is it referring to API or UI? Both? Mostly the former? Largely the latter (depending on plattform)?
- rumanator 7y agoAesthetically speaking, GTK is not ugly. Check Ubuntu 18.04 which adopted gnome3, thus has a Gtk+ UI.
- blattimwind 7y ago"(depending on platform)" ... you are naming the one platform Gtk+ properly supports.
- Polyisoprene 7y agoGTK still has extreme padding and wasted screen real estate around texts, images, lists and other component. Making a slim version and better designed UIs would probably make a lot of difference.
- i80and 7y agoThat's due to the GNOME HIG, which I agree is ugly. But GTK+ itself will render whatever padding you ask for.
- Polyisoprene 7y agoIt existed before Gnome and I’ve not yet seen any GTK interface that doesn’t seem like a slightly better looking Motif UI.
- vetinari 7y agoOn you typical laptop 14" FHD display, exactly this padding and sizing looks great (at @1x), while at 14" 1600x900 it still looks very good. Sure, on 1376x768 it looks terrible.
- timw4mail 7y agoWith default theming, GTK+2 looks like a bad ripoff of Windows 9x. (It's quite ugly, but not quite as bad as FLTK) GTK+3 has much better default theming.
- throwaway8941 7y ago>I then also have to remember what's the last episode I watched I find it quite funny how many complicated solutions to this problem there are. I simply stick a bunch of symlinks to whatever shows I am currently watching and remove them one by one. 20 line bash script + 1 minute configuring the file manager integration.
- rezeroed 7y agoI've done similar to replace my todo list - a directory of symlinks with numeric prefixes for ordering.
- idoubtit 7y agoAlternative solution for keeping track of where you stopped watching series : watch them with mpv. If you quit with "Q" instead of "q", it will remember the position. Then, whenever you launch mpv, it checks if one of the files is in its list of positions (using absolute realpaths). mpv series/* Q # continue from where I stopped mpv series/*
- Crinus 7y agoBack when i was using iMac as my "watch" computer, i was simply changing the text background color of whatever i was watching to green in Finder. The feature to tag and color any file is really something that i miss in Explorer (in Explorer you can edit tags if the file format supports it and Explorer knows about it, but this only works for some file formats and even then the UI is cumbersome).
- kitsunesoba 7y agoThe Finder’s color labeling feature has been useful for decades now, having been around since the early 90s iterations of the Mac OS. I don’t know why other file managers never picked it up; it deviates too far away from “Windows Explorer clone” I guess?
- jcelerier 7y ago>I then also have to remember what's the last episode I watched ... I generally just look in the "recent files" menu of my mediaplayer ? Also, many players are able to remember the last position in a file so if you open a file and are at the end...
- z0mbie42 7y agoTo the UI, too far from modern applications. I also heard that the API have some misfit with Rust ownership model: https://news.ycombinator.com/item?id=20368618 https://news.ycombinator.com/item?id=20368618
- heavenlyblue 7y agoI just don’t watch shows for which I can’t remember where I stopped :)
- deleted 7y ago[deleted]
- enriquto 7y agoI also contend the supposed "ugliness" of gtk. This is at most a personal issue; in my view gtk programs are typically beautiful and Qt and Electron are unbearably ugly.
- throwaway8941 7y agoEntirely depends on your system. On Linux/BSD with the right theme it can indeed look beautiful. I also quite enjoy the "plastic-y" feel it provides with some themes (like Clearlooks).
- langitbiru 7y agoWhat about GTK programs on Windows? I am not familiar with their case on Windows platform.
- _pmf_ 7y agoI'm using Textadept and Notecase on Windows. I personally like the Win95 aesthetics, but it's not everyone's cup of tea.
- Crinus 7y agoI also like the Win95 aesthetics, though last time i checked Gtk+ does support Windows' theme engine (not 100% perfect but 99.9% is there). At least Gtk+ 2 does, did that change with Gtk+ 3?
- Barrin92 7y agoI recently started to use a gtk audiobook player (https://github.com/geigi/cozy https://github.com/geigi/cozy, small plug as i've been very happy with it), and it looks absolutely fine to me. Of the three frameworks in the title traditional Qt Widgets apps to me look the worst.
- simion314 7y agoWhat do you not like about Qt? Are the apps or the Widget themselves? The apps are the job of the developer to align and padd things properly. The wdidgets are designed to look as default platforms Widgets, so on Windows you get the buttons and progressbars to look native, in Linux it will use the theme you set. Where GTK apps by default look horrible, they do not use the platform icons and styles or dialog boxes, I assume the reason is that Qt is sold as a cross platform toolkit where GTK is a Red Hat project and RH is focused mainly on GNOME
- deleted 7y ago[deleted]
- amelius 7y agoSee also: https://areweguiyet.com/ https://areweguiyet.com/
- bvda 7y agoWhat are the ratings based on? What are the criteria to receive a ++ rating?
- Narishma 7y agoIt's completely subjective.
- baybal2 7y agoI for long searched for a way to use GTK from nodejs. There are some proof of concept level bindings, but none exposing any much decent amount of the underlying functionality. Same for Qt I think
- IshKebab 7y agoWhy would you want to do that? Isn't the point of Node that you get a powerful GUI system but the tradeoff is that you have to use Javascript (or Typescript) instead of a nicer language?
- baybal2 7y ago??? What GUI system do you mean?
- IshKebab 7y agoHTML & CSS (via Electron)
- smolder 7y agoSome people like working in javascript, or it's just what they know. I would agree, though, that it's hard to make an argument for JS in that context on its technical merit. Even with the power and universality of a browser rendering engine, I think JS on the desktop is a disappointingly hacky way to avoid investment in purpose built cross platform UI toolkits. (Either building better ones or hiring people who know how to use existing ones.)
- _pmf_ 7y agoTangential: does Chromium have a native widget abstraction? Are there any projects that extract this layer and expose it?
- that_jojo 7y agoI can't remember if it's the same with chrome, but firefox actually uses its rendering engine to render the window chrome as well.
- scq 7y agoIt does, called "Views". There's some documentation on it in the Chromium codebase. https://chromium.googlesource.com/chromium/src/+/master/docs/ui/views/overview.md https://chromium.googlesource.com/chromium/src/+/master/docs...
- kodablah 7y agoI've used CEF to embed Chromium in Qt without too much difficulty. I made a C++ poc [0] and toyed with a Rust one a while back [1]. 0 - https://github.com/cretz/qt_cef_poc https://github.com/cretz/qt_cef_poc 1 - https://github.com/cretz/rust-qt_cef_poc https://github.com/cretz/rust-qt_cef_poc
- generichuman 7y agoI gave up trying to use native libraries for UI on cross-platform desktop programs. I'm playing with the idea to create a Web UI and launch it automatically from the Rust server by opening a browser and pointing it at localhost. No electron bloat. Has anyone tried this, any thoughts?
- mythz 7y agoNot in Rust, but that's my approach with .NET Core Desktop Apps: https://docs.servicestack.net/netcore-windows-desktop https://docs.servicestack.net/netcore-windows-desktop It also supports a super bloat-free option where entire Desktop Apps can be run from Gists. All Apps are run and share the same executable (and re-use its dependencies) so the Gists only need to contain their App-specific scripts and dependencies, giving each App tiny footprints: https://sharpscript.net/docs/gist-desktop-apps https://sharpscript.net/docs/gist-desktop-apps
- est31 7y agoI think cups is doing this as well: http://localhost:631/ http://localhost:631/
- patrickmcnamara 7y agoA lot of programs that are typically daemonized use this method. It makes a lot of sense for that use case, imo.
- korm 7y agoIsn't the browser more bloated than Electron?
- generichuman 7y agoI'm thinking of using the user's default browser, not downloading another one for my program. In most cases the default browser is already running - no need to launch another instance like electron.
- ScottFree 7y agoNo mention of imgui?
- dgellow 7y agoDo you mean Dear ImGui? Isn't it a C++ GUI? https://github.com/ocornut/imgui https://github.com/ocornut/imgui
- ScottFree 7y agoThere are rust bindings for Dear Imgui https://github.com/Gekkio/imgui-rs https://github.com/Gekkio/imgui-rs And nuklear (another imgui library) https://github.com/snuk182/nuklear-rust https://github.com/snuk182/nuklear-rust
- malkia 7y agoI've mentioned imgui too, and posted link to your comment. It needs to be evaluated here too. Coming from the game development world, there is a big appeal to the framework. It's author is responsive, the size is small, and the features are really what a game tool, or in-game debug screen may want. Easy to integrate, with various gfx backends (opengl, direct3d, etc.), and supports things that are not even done well by some of the other frameworks - like docking (which I've mentioned in my post). It has quirks, biggest one (to me), being how to deal when you have lots of widgets and their state (e.g. the hidden state labeling), then with my personal experiments I've found cases where the UI would lock, when flowing text, but overall seems to work well. On the other end, I'm really happy (myself) with Flutter, but then it misses the stuff that I just mentioned, though for a mobile app - you may (and most likely not) need these requirements. So two important, and recently new frameworks not included, I think they should... Flutter is direct competitor to Electron (now available on the desktop), and IMGUI to Qt/GTK.
- ocornut 7y ago> being how to deal when you have lots of widgets and their state (e.g. the hidden state labeling) Not sure exactly what you are referring you precisely? Happy to hear about it. Once you get the hang of what the ID Stack is for, normally you would push on the id stack for everyloop. > I've found cases where the UI would lock, when flowing text Never seen that sort of stuff happening.. if you do encounter issues of this kind please try to report them with some details!
- kuriho 7y agoIt's really sad to see that all the native options like druid got dismissed for being "not mature enough". Guess I'll stick to WebAssembly and CLI Apps.
- kgantchev 7y agoAt least it wasn't dismissed for being "not enought mature."
- raphlinus 7y agoIt's completely fair though, and I wouldn't want people trying to use druid while really basic functionality like menus is still being worked on. The only way I would recommend druid is if people want to roll up their sleeves and help build the toolkit. If it's still dismissed in six months to a year, that would be sad.
- littlestymaar 7y agoThe author of druid himself considers it immature at this point though… And unfortunately, Azul was abandoned by its maintainer a few month ago for family reasons, so it's unlikely to be polished anytime soon. At this point there is no viable full-Rust GUI toolkit, but druid may be one at some point.
- maeln 7y agoSome of the criteria are insanely subjective. For example: look. First off, as far as I remember, Qt and Gtk can be configured to use the OS theme, which mean that your GUI will respect the overall desktop theme. Electron does nothing of the sort and rely entirely on you to provide a good looking design. Responsive UI: Depending on how you use Qt or Gtk, you can easily be responsive using the various layout provided, at no extra cost. Finally, one big point that is not mentioned is accessibility. If most browser handle accessibility very nicely with the basic HTML components, if you start to do anything remotely advanced you gonna have to be careful and correctly implement ARIA norm, which most don't. Native UI framework are not perfect either, but can behave better in a lot of cases (it's not a clear cut though). Electron or local-server + webapp is really nice. Having done front end development as well has "native" application (with Qt), I can really appreciate how easier it is do to custom components using web technology, but I think we tend to dismiss their disadvantages too quickly.
- Liquid_Fire 7y agoI also don't understand the different "License" ratings for Qt and GTK, given they are both LGPL.
- z0mbie42 7y agoNot all Qt libraries are LGPL, some are GPL likce charts.
- vunie 7y agoI am also baffled by the difference in license ratings. My guess is that some parts of Qt are licensed differently (like their WebAssembly port) and it's not immediately clear which parts are licensed under which license.
- opencl 7y agoThe Qt licencing situation is way more complicated than that. Parts of it are available under LGPL, parts are available under GPL, and some parts are only available under a commercial license which is a minimum of $5500/dev/year. There's a big chart here: https://doc.qt.io/qt-5/qtmodules.html#gpl-licensed-addons https://doc.qt.io/qt-5/qtmodules.html#gpl-licensed-addons
- dgellow 7y agoI don't understand the critic about subjective criteria, people commenting here seem to assume that the list is supposed to be an objective and complete comparison of GUIs. The author evaluated the solutions for their own needs, of course it will be subjective. If they find something too ugly for the UX they want to have, that's a perfectly valid reason to filter something out.
- jcelerier 7y ago> people commenting here seem to assume that the list is supposed to be an objective and complete comparison of GUIs well yes, that's what you get for naming your blog like a research paper
- z0mbie42 7y agoHi, author here, I understand the critics against the subjective criteria like "Look". Look means: the ability to create a native app which is at least beautiful as modern WebApps. e.g. Slack or VSCode (Electron) are beautiful, while fractal or NoteCase (Gtk) are not.
- techntoke 7y agoSpotify and Telegram are both examples of good looking Qt apps, but I prefer standardization of the menu bar which neither do very well.
- Crinus 7y agoBut that is still entirely subjective, i pretty much prefer Notecase/Fractal to Slack/VSCode. As i wrote in another reply you probably want to rename this to themability (or customizability, but that can be a bit vague whereas themability is a common feature that one may want from a GUI toolkit) instead of look.
- leshow 7y agoHow are you going to claim that Gtk doesn't have a 'responsive UI'? It's native, it's very responsive. Unless you mean 'responsive' like 'works on mobile'. Which seems kind of a moot point considering we're talking about desktop applications.
- anchpop 7y agoResponsive usually means it responds to changes in screen size by adjusting to a nicer layout at that size (3 columns turning into 1, for example)
- leshow 7y agoIt's not usually used in that context for desktop applications
- Crinus 7y agoIMO that is one of the most annoying misfeatures i've seen... on websites it is practically always used to distinguish between mobile and desktop, which misfires completely if you have a 1366x768 monitor and you aren't running a fullscreen browser, whereas on desktop it is always done because the application is ignoring all the screen real estate it gets by padding everything like balloons, using titanic font sizes (ignoring the system wide settings for fonts and sizes, of course), etc. In theory it should be applications automatically showing and hiding features based on the available allocated area so that you could have (on desktop at least) multiple applications visible at the same time and have a dynamic view of their content's details just by resizing them. Which is a good idea. In practice however it ends up as a band-aid for self-inflicted deficiencies.
- z0mbie42 7y agoBy responsive I mean which can adapt to screen size. It's useful because we see more and more 'convergent devices' like the librem 5, pr a raspberry pi with a 10' screen
- kodablah 7y ago> The following options exists but were not included because they are not mature enough. > Web broswer communicating with a Rust local server: too much hacky, insecure? (DNS rebinding attacks) and does not support native features like tray icons. You should not discount this, Golang solutions like lorca [0] do just fine with this using devtools proto for comm (systray can be a separate lib). DNS rebinding attacks are just a host header check away from mitigated. At the least, check out webview [1] (and its in-dev successor impl [2]) for not requiring Chrome and having more direct control. Also, you should look at CEF which ships with Chromium bundled (it's not too huge) and has a C-FFI easily consumable from Rust. I have used this approach with success. 0 - https://github.com/zserge/lorca https://github.com/zserge/lorca 1 - https://github.com/zserge/webview https://github.com/zserge/webview 2 - https://github.com/zserge/webview/tree/webview-x https://github.com/zserge/webview/tree/webview-x
- baby 7y agoIsnt the only way to defend against dns rebinding to add authentication to your local server?
- kodablah 7y agoFor these localhost-only servers, a simple check on Host is fine. E.g. if you're on 127.0.0.1:3000, checking that Host is strictly 127.0.0.1:3000 or localhost:3000 is good enough.
- baby 7y agoDoesnt dns rebinding trick your browser into thinking this is indeed your host?
- kodablah 7y agoDNS rebinding involves changing your host's really-low-TTL A record to 127.0.0.1 (or other internal IP), and then on next request the browser will then assume that's what the host is and make call to that new IP assuming same-origin...but it sets the Host header as what the browser thinks represents that IP. If it's not localhost or 127.0.0.1 (for this use case) then we know someone tricked into thinking it was theirs that was our local IP. So check the Host to make sure it isn't someone else's host "re-bound" to your IP.
- Hitton 7y agoI've not learned Rust yet, but unless it does behave really weird, I can't believe that Electron and Qt have roughly same RAM usage. In my experience Electron has usually 2 to 3 times higher RAM requirements than Qt application of similar scope.
- hacker_9 7y agoQT these days is written in a JavaScript-esqe language and runs a modified WebKit to power the UI. It's as bad as it sounds.
- adev_ 7y ago> QT these days is written in a JavaScript-esqe language and runs a modified WebKit to power the UI. It's as bad as it sounds. That's wrong. QML has two mode: one "interpreted" ( the javascript-esque) and one that can be compiled to native C++ without js. And WebKit / webview itself is a plugin for Qt, it is absolutely not required.
- jcelerier 7y ago> QT these days is written in a JavaScript-esqe language and runs a modified WebKit to power the UI. ... that is entirely false. Qt has its own scene graph renderer which has nothing to do with WebKit.
- z0mbie42 7y agoIt's because almost all electron apps are written fully in JS. In the context of the article, the UI is in HTML/JS and the business logic in Rust, thus the RAM is not so high. On the other hand, Qt QML embed it's own JS engine which is not resources light.
- bla3 7y agoIt's almost if the GUI ecosystem is mostly independent of the language used. That's because GUI frameworks are a lot of work, so it makes more sense to have bindings to existing ones.
- billfruit 7y agoI feel that the brushed metal tone or shading that earlier gnome/2.x gtk+ had was very aesthetically pleasing, not seen it replicated anywhere else.
- simonh 7y agoThe Mac had a brushed metal theme, used on some apps like Quicktime and iTunes, since 1999.
- rubyn00bie 7y agoThis is a pretty terrible write up; and I honestly don't know how the author subjectively arrived at the conclusion that only QT, GTK, and Electron are worth testing. I sort of wish context was given for this as the summary, as "get shit done" could hardly be implied from this list. Just my two cents.
- z0mbie42 7y agoThank you for the "useful" feeeback :) Maybe you can do your own so you can tell us the GiGa TrUtH about modern GUI frameworks.
- rubyn00bie 7y agoI said it was terrible and explained that your reasoning of "get shit done" lacks any tangible meaning to the rest of the world. Don't be salty because I posted my opinion, I didn't say you were a terrible person for writing it. If you would've just titled your post "a review of electron, gtk, and qt for making UIs with Rust" I'd have less of an issue. You also stated in another post in this thread, and not in your article, that you feel "Slack" is beautiful and that "beauty" was a necessity. That sounds like your principle deciding factor; not, "get shit done." There's lots of things you could have done, but the responsibility isn't on me to coddle you through my thoughts. You could've just responded and qualified "get shit done," and started a dialogue but alas... you decided to reply like a child because you're upset. Maybe next time you shouldn't post to HN if you're gonna let comments from random folks get you down.
- z0mbie42 7y agoI just prefer actionable feedback rather than grunting. As product developers we have the responsibility to create great product. One of the criterion of a great product is beauty. Get the shit done is just a summary of the previously mentioned criteria. I would looove to be proven wrong that Electron, Qt and Gtk are not the only viable options and would happily investigate further. But I would also love to stop seeing random grunting from people who never had written (or event tried to write) great Gui desktop applications. (I'm not sayimg that you never have, I'm saying that by telling those are not the only viable options you look like never have).
- malkia 7y agoAn important aspect to compare is docking. Any application that can span on multiple monitors, soon or later requires proper docking (window in window, etc.). Even if it's a single window, it's still a challenge. Qt is almost there, but not as good as say Visual Studio (whatever docking framework they are using). To be more blunt, any content creation tool (3D model/animation/etc editor) needs to support it. Take any Autodesk product for example (most of them use Qt). Dear IMGUI in this respect added recently pretty good docking system, and it's not in this list - someone else also mentioned that https://news.ycombinator.com/item?id=20776848 https://news.ycombinator.com/item?id=20776848 Thanks!
- jcelerier 7y agoThere is a nice improved docking system being developed for Qt by KDAB (disclaimer: I work there) : https://github.com/KDAB/KDDockWidgets https://github.com/KDAB/KDDockWidgets It closes the gap a fair bit with the VS docking system
- todd3834 7y agoLately I’ve been experimenting with the idea of fully native cross platform desktop apps. Latest iteration is to write the majority of the app in Go and communicate with a native frontend over TCP. So far I’m finding that building a really simple UI and communicating over TCP to be pretty simple. At the same time I keep the majority of the business logic in the go server. It probably doesn’t work for all app types but it is fun to play with. With Rust I imagine taking advantage of LLVM you could just import the business logic into whatever app environment you need to and work it that way. Has anyone here tried that? I would love to hear how it went.
- rootlocus 7y ago> Latest iteration is to write the majority of the app in Go and communicate with a native frontend over TCP You need a protocol over TCP. Something standard and easy to use, hopefully one that people already know and has wide support from libraries. HTTP? Native UIs are nice, but the cool kids like to stylize their UIs. Things like gradients, shadows, highlights, animations, etc. And wouldn't it be cooler if you go to all that trouble to stylize your UI to have it look the same on all platforms? What if you add another layer on top of the underlying UI framework? Something that lets you compose UI elements from basic shapes, maybe a way to separate the layout from the style? HTML + CSS. Oh wait, we reinvented electron again.
- c-smile 7y ago> Latest iteration is to write the majority of the app in Go and … Check Sciter/Go : https://github.com/sciter-sdk/go-sciter https://github.com/sciter-sdk/go-sciter It is used precisely that way: backend - Go, UI - Sciter.
- sayusasugi 7y agoAn Electron flame war seems inevitable. It's fine for quick cross platform support but it absolutely screws over the user. QT is far from perfect but at least it's native.
- sime2009 7y agoIs what sense is Qt "native"?
- mynegation 7y agoIn the sense that the executable is the machine code, not the Javascript interpreter running through js files. In the sense that Electron is actually native code (Chromium) running HTML UI and QT running its own custom-drawn UI, both different from whatever platform-blessed UI toolkit is, no, QT is not "native"
- adev_ 7y ago> QT running its own custom-drawn UI, both different from whatever platform-blessed UI toolkit is, no, QT is not "native" Most Qt Apps are still using the widget layout in pure C++ ( from the stats of the Qt company itself ) and do not contains a single line of JS or interpreted language. Then yes Qt is native and Electron is not.
- c-smile 7y agoSciter/Rust (https://github.com/sciter-sdk/rust-sciter https://github.com/sciter-sdk/rust-sciter) was not tested: https://gitlab.com/z0mbie42/rust_gui_ecosystem_overview#not-tested https://gitlab.com/z0mbie42/rust_gui_ecosystem_overview#not-... but conclusion "The most promising seems to be Flutter" was made already :)
- buildzr 7y agoWhat exactly does "security" mean in this? Difficulty of reverse engineering?
- z0mbie42 7y agoSecurity means the global security of the framework. Using electron exposes to some future chrome/Node CVEs and the past ones. Qt on the other hand is used a lot in emdedd devices/automotive so we can expect security being a top priority of the developers.
- the_why_of_y 7y agoThe reason why browsers have so many CVEs is that they routinely run untrusted code; hence browser developers invest a lot of resources into sandboxing the untrusted code and finding and fixing security holes in the sandbox and all of the native code that is callable from within the sandbox. For an Electron app, most of these CVEs are probably irrelevant, because the code isn't untrusted in this case as it is bundled with the app already so sandbox escape isn't an issue. (Similar arguments apply to Java with browser plugins vs. "real" applications) Native toolkits are never used directly from untrusted code; obviously this means they won't have a CVE for sandbox escaping because there isn't a sandbox. But it also means they have a much smaller incentive to look for security holes in their code. CVEs are security bugs that were found and fixed, and number-of-CVEs is not an indication of how many unfixed security bugs remain. While the attack surface is smaller if you don't run untrusted code, it typically isn't zero, depending on what untrusted inputs a particular application reads. I'd bet that some security relevant UB in a Qt image decoder would take a lot longer to find than a similar bug in a browser's image decoder, simply because of the incentives. Example, try googling "browser security bounty", then try again with "qt security bounty".
- z0mbie42 7y agoElectron have CVEs which are not directly related to the browser: https://wickr.com/electron-vulnerability-the-quest-for-cool https://wickr.com/electron-vulnerability-the-quest-for-cool
- hacker_9 7y agoWhere is imgui bindings in this list?