7 ms·
Xilem – An experimental Rust native UI framework
- sheepscreek 6mo agoBeen using it with mixed success. While I love vello, Xilem is less mature in comparison. Many standard UI components, such as selection box, are not implemented yet. On the other hand, it’s a great opportunity to become a contributor towards a genuinely useful and promising project!
- mtndew4brkfst 6mo agoWas there some new developments with this project that renewed interest recently? I started learning Rust in 2018 or 2019 and I think "good Rust GUI" research is probably at least that old.
- wmf 6mo agoThe last demo I saw just had a button so the chess app shows a lot of progress.
- brainless 6mo agoI keep trying Xilem and then egui or Iced. Xilem needs more widgets out of the box to be easy to build with. Slint is another option. I wonder what cross platform GUI framework (from any language) will finally become as common as Electron based apps or the vast number of native OS apps in Windows or macOS or Linux. I keep going back to Tauri, which is practical to build desktop apps quickly but still uses HTML, CSS, JS to build the UI. You can use Rust web UI tools but then it is still (system) browser based.
- synergy20 6mo agoQT does it well but the license is a maze
- ahartmetz 6mo agoQt is LGPL. Anything that's complicated about that is Qt Company sales tactics. It's really just LGPL. Unless you were talking about commercial licenses - in that it's not that complicated neither; it's expensive.
- synergy20 6mo agoI wish it's that simple. Not all components are LGPL, so when you're doing LGPL and you suddenly need some must-have-but-not-LGPL component,you're in trouble.
- tvshtr 6mo agoSomething like GPUI probably, I would be quite happy with it if it wasn't so tied and restricted by the Zed's team (they reject PRs because they're not strictly related to Zed), there's even mobile fork. Dioxus native would be second, but it's far far far away from being ready.
- Levitating 6mo ago> they reject PRs because they're not strictly related to Zed What kind of PRs? Like new widget components or what? Maybe https://github.com/longbridge/gpui-component https://github.com/longbridge/gpui-component would be more keen on accepting PRs like that?
- jenadine 6mo agoFor example https://github.com/zed-industries/zed/pull/42905#issuecomment-3647662949 https://github.com/zed-industries/zed/pull/42905#issuecommen... So there is now a fork: https://github.com/gpui-ce/gpui-ce/ https://github.com/gpui-ce/gpui-ce/ But I don't know if that's sustainable.
- Levitating 6mo agoThat's disheartening, though also understandable from Zeds point of view. I hope the community fork could gain traction. I believe there's a lot of potential in GPUI.
- tvshtr 6mo agoYeah, it really sucks as I really like it, but I've been hitting edge cases which would be solved by some of the PRs mentioned.
- tvshtr 6mo agoNot possible to do it via component. I've seen various, like custom user shaders or some silly basics like text justify (which is implemented in cosmic-text crate used by gpui). That's why it was forked.
- feverzsj 6mo agoCross platform GUI is extremely hard. Qt is the only good choice, even though it's still far from mature after 30 years of development.
- dafelst 6mo agoFWIW Slint was founded by a group of long time Qt alumni, so brings a lot of that know-how into the space.
- noodletheworld 6mo agoI gave it a decent shot, and I wanted to like slint, but I don’t. It’s not a rust ui system; it’s a declarative ui language that happens to have a rust binding via macros so you can write the custom DSL. It also has bindings for other languages. It feels like a bunch of qtquick people got together and implemented a new runtime for qtquick. That might be the direction qt has gone, at the expense of their c++ qtwigets system, but it just feels… “electron app” to me. If I wanted an electron app, I would just use electron. If I wanted a non-native ui look and feel, I would use flutter.
- jenadine 6mo agoSlint has nothing to do with elecron. There is no browser under the hood so it is much more lightweight. Slint has native looking widgets. Slint DSL gets compiled to native code: no need for a runtime interpreter like in QtQuick
- IshKebab 6mo agoIMO this is the best Rust GUI option at the moment: https://github.com/longbridge/gpui-component https://github.com/longbridge/gpui-component
- FrankenApps 6mo agoThe only things I don't like about this is a) your binaries will become huge and very slow to compile with optimizations enabled and b) it's dependence on GPUI and its unsure future direction (I'd like to see GPUI thrive outside of Zed but the maintainers have clarified that that's not the goal for now).
- ldng 6mo agohum, well, not that convincing : Failed to open window: WebGPU context not initialized. Was Platform::run() called? Not being able to load the component gallery does not inspire great confidence.
- sourcegrift 6mo agoVery happy with qmetaobject-rs. Qt is tried and tested, dnd multi platform. Also, UI itself is best done declaratively not imperatively. Qmetaobject-rs gives you the best of both worlds: great UI declaratively, logic in Rust.
- eviks 6mo agoIs there a plan for this to compete the experiment any time (soon)?
- _stillmind 6mo agoWhy not just use Flutter with Rust, via the flutter_rust_bridge (https://cjycode.com/flutter_rust_bridge/quickstart https://cjycode.com/flutter_rust_bridge/quickstart)? Seems like a reasonable combo to me.
- t_mahmood 6mo agoTo me it felt like it will break if I look at the code from down to up instead of up to down. And then I have to recompile flutter, the bridge and nuke the whole rust package folder to make sure it's clear and in workable state, then find other projects are now broke. I joke, but probably rustdesk is so glued together, it created that bad impression on me.
- amarant 6mo agoGiven the similarity in "inspired by" projects, how does this compare to iced? I've found iced to be surprisingly mature in every aspect I've tried, except the documentation, which is severely lacking
- CapricornNoble 6mo agoWhy should I try to learn this instead of Slint?
- jenadine 6mo agoIf you want to build a real app with a stable toolkit, use Slint. Try Xilem if you want to experiment with new, experimental way to build UIs in Rust.
- mtndew4brkfst 6mo agoIf Slint's licensing terms don't bother you, that's cool. They are more restrictive than most of the Rust ecosystem being dual Apache/MIT, though.
- malekpour 6mo agoI've done a small project with Dioxus on Blitz. It is principally very close to Xilem and in fact is using some of the Xilem components. https://github.com/DioxusLabs/blitz https://github.com/DioxusLabs/blitz
- nicoburns 6mo agoYes, we are collaborating closely with Linebender on Parley (the text engine) for which we have contributed a lot of code mostly for additional layout features (like the ability to layout images and other content inline with text). And slightly less closely on the Vello renderers for which we haven't directly contributed much code, but which we support as backends for Blitz which we have used to help with validation and testing.
- creata 6mo agoWhat's the rationale for using Rust to write a UI? Using a scripting language (or at least a garbage-collected language) is much less restrictive, and it's not like the "what goes where" UI code is especially performance-sensitive.
- QuantumNomad_ 6mo agoSame reason every other language has UI frameworks. It is more comfortable and nice to write the whole desktop program in the same language.
- jauntywundrkind 6mo ago[flagged]
- creata 6mo agoI have been watching people write UI frameworks in Rust for over a decade, you meanie. The results tend to involve more dynamic allocation than you'd see in a garbage-collected language, or tons of reference counting (e.g., in Leptos) that acts as a less efficient GC. I've read many of raphlinus's posts, and while they're always interesting, the total experience in the Xilem examples just seems like much more effort than using FFI (even C FFI) to glue to something more workable. Your comparison to assembly is very bizarre - languages of the sort I mentioned are usually at least as safe as Rust, and the "scripting language for top-level logic + compiled language for the bits that need to be fast" combination is ancient. In fact, your vague allusions to "a stable base, without infinite danger everywhere" shows much less understanding of what's at stake, in my view. I'm sorry my question wasn't enlightened enough for you. And this is a news aggregator. Not the official discussion forums or anything. People can ask small insignificant questions here, or so I thought. I'm so tired. You write one measly paragraph that could simply be ignored and someone calls you a "perpetuate drain". Even the chatbots have more humanity than you've got.
- jauntywundrkind 6mo ago
- pointlessone 6mo agoI’d wager that it’s as native as Electron. It might be faster, sure, but it’s not native to any platform.
- bananapub 6mo agoraph wrote about that already: https://raphlinus.github.io/rust/gui/2022/07/15/next-dozen-guis.html#a-small-rant-about-native https://raphlinus.github.io/rust/gui/2022/07/15/next-dozen-g...
- pointlessone 6mo agoI agree that there’s chaos everywhere and system integration on individual axes is a better way to look at it but then it turns out that Electron is more native than most GUI libs out there. Browser devs worked very hard and for a long time to integrate with host OSes. Browsers have native text rendering, good accessibility, IME support on all platforms, etc. All these features are usually missing from the hot new UI libs. ImHex is a great hex editor, lots of features. It’s got antialiased fonts like only a year ago. Fonts still look not exactly as the rest of the OS. Has no accessibility integration at all. Zed, looks pretty good at first glance. No accessibility. “Native” implies all the features that the platform provides. It is chaotic on all major platofrms but it’s still meaningful.
- embedding-shape 6mo ago> but it’s not native to any platform Why is this still a talking point? So what if the app renders with AppKit or Cairo on macOS, you can both look as native as the other, doesn't the actual UX matter more than how the implementation was made?
- ghosty141 6mo ago> you can both look as native as the other, doesn't the actual UX matter more than how the implementation was made? An Electron app that draws all its components mostly like the native controls will still not be native and have the same integrations etc. that native apps usually get. You could get close but some things like for example "ctrl+f" search have native widgets that work different/look different that an electron app realistically won't have. Or for example you will never get the same liquid glass materials that macOS uses in an electron app. So yea, native in my books means using the platform native (UI) apis. On Ubuntu for examples thats GTK, on Windows its.... idk at this point, WinUI? and on KDE it would be Qt.
- amelius 6mo agoCan it render SVG with all of its features? (Does it support all modern 2D drawing primitives)
- raphlinus 6mo agoThere is an Svg widget. It only supports static images, not animations, though this is certainly something I'm interested in. It does support the modern 2D imaging model. It is in transition from using "Vello GPU" (aka Vello Classic) to the understory imaging abstraction, which means it can use any competent 2D renderer, including Skia.
- mellosouls 6mo agoAre we GUI Yet? The state of building user interfaces in Rust. https://areweguiyet.com/ https://areweguiyet.com/
- Levitating 6mo agoI recently added SDL3 to that page
- alfanick 6mo agoWhat's native about it? It seems like custom GPU rendered thingy with nothing "native". Linux GUI frameworks are hot potato, I tried to write "native-feeling" app with taskbar icon lately on Linux (Cinnamon), intuition says GTK3, Internet says GTK4. Cinnamon says write it in JS and plug it in as an applet. Qt seems like the most complete GUI framework, but I don't like KDE (and Qt on mostly GTK based env looks weird). Windows is the same, Microsoft has like 10 different UI frameworks from different epochs. MacOS seems to be the only one with some common UI framework.
- longor1996 6mo agoSeems to be "native" as in "not a web-browser/view".
- raphlinus 6mo agoIndeed. I try not to use the word "native" these days as it has such ambiguous meaning. I also have thought for a while that Windows no longer has native UI, only legacy (Win32) and a rotating carousel of mostly-failed attempts. There have been a few HN stories in the last week that bear me out, notably [1]. Mac of course is in better shape, as AppKit and SwiftUI are both viable (and interop well enough). [1]: https://news.ycombinator.com/item?id=47651703 https://news.ycombinator.com/item?id=47651703
- alfanick 6mo agoIt's a step forward. If someone makes an app which is some Electron/WebView thing and call it "native", my thoughts are immediately rather illegal. Cool, so it's UI framework that doesn't actually make a webpage presented as an app. Truly native for me means: using UI framework that is the gold standard for given OS, UX native for given OS, and using native OS APIs, so my laptop can actually survive 24h on battery. It's truly hilarious that Claude app (and ChatGPT) is just Electron app - argument that writing UI in Electron is cheaper is no longer valid in AI age, but yet they did it. Weird times.
- Levitating 6mo agoNative in the sense that it renders using the GPU directly (or rather via WebGPU) instead of relying on a webview. On Linux you're right to say it's basically choosing between gtk and qt.
- wangii 6mo agowhat's the difference between Xilem and GPUI? GPUI is used in zed and pretty cool!
- Imustaskforhelp 6mo agoI tried to play with GPUI for making a scratchpad like app with zed and It was one of the most rough experiences out there. They mention it in the readme though that it has rough edges but I hope that they make in the future more easier to tinker around.
- Levitating 6mo agoThis set of components is a nice compliment to GPUI: https://github.com/kiruhq/wgpui-component https://github.com/kiruhq/wgpui-component Xilem is more like Iced but with it's own patterns and underlying graphics library.
- wiz21c 6mo agoTested egui and it's great provided you accept the "immediate mode" and its limitations. It's quite polished nowadays although it misses in some areas.
- Serhii-Set 6mo ago[dead]
- Levitating 6mo agoIf you want to learn more about Xilem's architecture I recommend Raph Levien's blogpost: https://raphlinus.github.io/rust/gui/2022/05/07/ui-architecture.html https://raphlinus.github.io/rust/gui/2022/05/07/ui-architect...
- sandreas 6mo agoWhile I love seeing many alternatives regarding UI frameworks, I'd love to see one general purpose "market leader". I love `iced` for its simplicity and flexibility, but unfortunately there is no official software renderer, which makes it impossible to use for my little embedded side project. `Slint` is also usable, however I'm not sure about the licensing approach that makes you pay for non open source projects (which is totally understandable, but somehow this feels like a no-go for the "leading" UI framework). The Slint UI DSL feels very good at first, but the more you use it, the more you run into limitations like missing async support for callbacks, the lack of importing structs from Rust into and export UI structs to Rust, etc. However, it at least supports a software renderer and framebuffer. Is there any other lightweight UI Framework supporting software-rendering and framebuffer for embedded devices (RISC-V 64bit musl, LicheeRV Nano)?
- FrankenApps 6mo agoIsn't pure CPU rendering possible in iced with the tiny-skia backend?
- sandreas 6mo agoMaybe... Is this framebuffer? My platform is pretty unusual (riscv64-musl), so I was pretty happy when something was working. If your interested, it is a portable audio player with the size of the iPod Nano 7g: https://github.com/nanowave-player/nanowave-ui https://github.com/nanowave-player/nanowave-ui
- nicoburns 6mo agoYou might need to modify it slightly to get it to render to the right location, but it's a pure software renderer. You could ask in the Iced zulip https://iced.zulipchat.com/ https://iced.zulipchat.com/
- FrankenApps 6mo agoCool stuff. Have you tried https://github.com/embedded-graphics/embedded-graphics https://github.com/embedded-graphics/embedded-graphics ?