Show HN: Sauron-native – A native cross-platform GUI for Rust
github.com
github.com
Unfortunately, in the GTK+ 3.x era and beyond, the perspective of many KDE users is that hell has frozen over because GTK+ has supplanted MacOS as the GUI with the most alien feel to it.
(Plus, the LXDE developers started a transition to GTK+ 3.x, got fed up, and decided that their upgrade path from GTK+ 2.x would be Qt 5. They then merged with Razor-Qt to form LXQt.)
Personally, what rubs me the wrong way the most is the various ways in which it explicitly goes against what HCI research recommends because the GNOME people just liked it better their way. (And I've read quotes by the devs showing that they now see GTK+ as GNOME's toolkit first and other desktops are on their own if they don't want to ride along... which explains things like how long it took them to stabilize the GTK+ 3.x theming APIs.)
I still might consider it if the gtk3-mushrooms patchset for making GTK+ 3.x less alien weren't a single-person, amateur effort that's only packaged for Archlinux.
Edit: To be clear, I'm not comparing the relative merits of different GUI options, I'm saying that GTK is the only option that you really have in Rust today.
As I mentioned in another comment, I value my GUIs feeling native on my KDE desktop (and not having to reinvent things like QSettings and, last time I tried with GTK+ 2.x, drag-and-drop multi-select for list views) strongly enough that I start with PyQt and then add rust-cpython and Rust if enough of the application can be cleanly encapsulated away from the GUI code to justify the added build-time complexity.
...though Qt's QTest module does help to balance things out a bit, by providing a Selenium-like facility for automating GUI interactions.
relm might be a much saner approach to avoid trying to understand why some button callback cannot read the text from an input field and such stuff.
[0]: HN comment -(https://news.ycombinator.com/item?id=19746440)
> 2.1) I want to ship something that looks the same on Windows / Linux / MacOS
As a user: No no no, please, no.
I want apps to fit the look, feel, and idioms of the OS I'm currently in, not "look the same" on every OS.
For example. macOS in particular has many builtin features that work in all apps with standard controls. Like text-to-speech, or converting selected text into all-caps, lowercase, or capitalized. Or custom services/scripts built in Automator.
I may not always use these little tricks all the time, but when they fail to work in some app, it immediately feels lower quality, suspicious, and/or suggests a lazy developer.
It's not pleasant to use something that ignores the special features of a platform in favor of the lowest common denominator.
When I’m using an advanced UI to do some specialized task, I generally appreciate when the UI patterns I learn on one OS transfer seamlessly to any other device and OS I may use to do the same task.
But I especially appreciate that apps can choose the UI style and design to suit the task at hand, rather than some notion of conforming to OS style patterns that may or may not work in its favor. For example, I prefer that Visual Studio Code looks the same on all platforms, because I find its UI to be superior to the default style of any OS!
What do you think about these thoughts? Am I alone in preferring custom UIs per app, with consistent app experience across devices?
[1] For the sake of this argument, I’m not counting differences in runtime performance and efficiency, since that’s a whole other topic, and one theoretically orthogonal to the UI design.
Custom UIs by themselves are not the culprit. Apple itself is "guilty" of that, using special controls and styles for their own apps (including even the new Reminders in Catalina.)
But if an app on macOS puts a close button in the upper-right corner of a window or panel (like Windows does) instead of the upper-left, for example, or when an iOS app uses the Android sharing icon, I feel annoyed.
A worse and more practical example is when an app is missing some of the global system features I described in my previous comment, like common text field options (spelling, transformations, dictionary lookup etc.) missing from an Electron-based chat app and so on.
2. HTML and JS make sucky UIs regardless of how much "work pools", because the underlying APIs are limited and incomplete. For example, scrolling: there is no native support for large tables in HTML, so apps either do some janky faulting in like infinite scroll, or reimplement scrolling entirely. Cut/copy/paste/undo is another example, along with keyboard navigation in general.
Most cross platform applications feel alien somewhere, and I use Windows, Mac and Linux enough that I'd rather a given app be more consistent to the application. Yeah, make the toolbar use the global one if there is one, use the menu conventions, etc... but beyond that, I'd rather the app be pretty consistent to itself over the OS.
As an example, most archive manager applications, and a lot of file transfer/storage applications are really painful to use on macos vs windows or linux where they just feel better and more usable.
1. it has to look and behave the same way everywhere (because we don't want to have to retrain users when they switch platform, to maintain several documentation and marketing materials, and because we want to respect the designer's esthetic vision, and / or corporate graphical vision)
2. It has to look and behave native everywhere (because we don't want to confuse users of any given platform.)
Again : of course, I know they're contradictory ! If you have a sword to cut that knot, go for it !
And of course you're perfectly allowed to value requirement 2 more than requirement 1.
And sadly here, different user's interests are not aligned with different software producer's interests, so we're basically not going to please everyone.
Again, I have neither data, nor religion, nor solution about this.
(note: despite the name and origin, i do not consider UWP as regular Windows applications and i want them to die in fire)
More and more, I'm preferring the MS (Whatever the name of the day) and Google (Material Design) approaches for inside the app, with either an integrated or global menu as appropriate for the platform. With the rest in-app experience with a clean UX.
Again, I understand the desire, but most windows programs, in particular MS generational applications, already have disparate user interfaces.
The UIs can be styled and modified to an app author's liking, but unspecified properties fall back to the operating system defaults (assuming the Chrome developers did their jobs well).
I’m probably very naive here- since I am not a rust or swift developer!!
The GSoC student project is a GPU compute renderer for 2D graphics. Early experiments (piet-metal) show promise that this could advance the state of the art.
hmm, strikes me as a good use of time!
hi ^)^
My current challenge is to swap out different top-level views as I navigate to different parts of the app. This may may be something best suited to something like Cursive.rs, but I'm still holding out hope that the GUI toolkits will mature at a reasonable clip.
It's really quite refreshing to see something more portable and lightweight than Electron gain traction. So far the only major detractor I've seen is that the project uses Zulip for chat/messaging and it's put behind a registration wall.
See e.g. https://github.com/rust-windowing/winit/issues/159
If you create a rust ui framework that supports the VST windowing/event loop model and just supports one GUI backend on Win32/MacOS, then many people in the audio plugin community would be very happy.
I’ve been experimenting with several gui libraries in Rust lately and so far the GTK3 bindings seem to be the most promising for building native GUIs in Rust.
With native I mean GTK/Qt style fast/performant widgets that do not necessarily use platform-specific widgets.
This project seems to use GTK as one of its backends. I’m curious to see how the multiple backends architecture will influence the library design as GTK, html and TUI are vastly different.
On the GTK-rs side the documentation [1] is much better and I was up and running with a sample project in a few minutes.
[1]: https://gtk-rs.org/
As a KDE user, QML is about as useful to me as GTK+ when it comes to feeling native, so bindings built around those APIs are out.
rust-qt-binding-generator (the one maintained by KDE people) is fundamentally designed around the assumption that you're comfortable writing parts of your program in C++. (It's designed for embedding Rust pieces in a project with its own build automation, like CMake, and where hand-written C++ will still be used for part of the process of talking to Qt.)
rust-qt comes the closest to what I want (something where, as long as I don't touch the `unsafe` keyword and I only pick trustworthy dependencies, I can't accidentally introduce memory-unsafety into my project.) but "Creating custom signals from Rust code." is still on the TODO list and its development seems to have run out of steam.
So far, my solution has been to use Rust to write a cleanly encapsulated backend, use rust-cpython to expose it to Python, and then use PyQt5 (because I haven't started a new Qt project since PySide2 matured) to build a frontend, producing a QML-esque development experience for the QWidget APIs... though I'd still much rather have strong compile-time checks for the entire project.
X11 and wide idea of terminals go in hand. It's a problem of abstraction and platforms evolving. So I think, that you either end up with something like Web front-ends of today or something more structured, but far simpler like various TUIs or maybe Tcl/Tk with it's windowing shell wish. I think that some middle ground is possible, but hard and shifting quite fast.
However, things are different now. We could embed Lua or WASM into the display server, and you'd have a much more programmer-friendly platform that can run efficiently enough to feel snappy. We have more memory, so you don't need to share toolkits between applications.
Maybe it's time to revive the concept.
I think the author might have to support GTK+ theming options to counter this issue then? If not then perhaps using GTK+ for Linux and using the win32 and cocoa crates separately and abstracting that might be something worth looking at?
It is not worse than electron in that respect ;). But some small Rust Gtk+ utility that I have for personal uses a whopping 7564KB of resident anonymous memory.
This used to be a problem in the past but not anymore. I would really like to finally see Rust's answser to having a non-Electron cross-platform GUI library.
2020 was already slated for Rust for me but this may make me start dabbling in it a few months early (assuming I can find up to date leaning materials)
Tldr great job, please don't give up on the hard part of win32 and macos but this has a great foundation feature set.
...and the author is abandoning it to move on to other things?
/shrug
Didn’t solve any of the actually hard problems of a cross platform or rust based UI imo.
https://github.com/andlabs/libui
We're considering using it for the next generation of the ZeroTier desktop UI. Unfortunately no mobile support (but we already have native mobile UIs), but it looks like the best contender for a cross platform UI lib that is light and fluffy and simple. Rust bindings should be trivial. There are high quality Go bindings here:
Can you comment on whether you evaluated Java Swing or Java FX as a cross platform UI lib for your needs? I am curious to hear others thoughts on the matter.
If something runs on a Raspberry Pi, that's not exactly a proof it's light weight.
I'm pretty sure this has changed since the last major Raspbian update, but the Pi still isn't quite at parity with more mainstream desktop hardware.
Javafx/tornadofx or maybe wxwidgets/qt is a better choice
It also breaks the site guidelines, which include: "Please don't post shallow dismissals, especially of other people's work. A good critical comment teaches us something."
This does not apply if your application has so many custom controls that being native does not matter that much (for example a music creation software or a highly advanced raster editor)