Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What does Zed use as the UI toolkit? Looking at the code they have a handmade UI toolkit called gpui. Does that map directly to OS/DE specific GUI bindings? I can't find where that's happening

EDIT:

Holy sh*t, they actually have bindings for each OS and built a Rust abstraction on top of that. That's pretty wild

https://github.com/zed-industries/zed/blob/main/crates/gpui/...



> Holy sh*t, they actually have bindings for each OS and built a Rust abstraction on top of that. That's pretty wild

I grew up developing Windows apps using the native Win32 API:s, and there was nothing particularly daunting about it. Using what the OS provides shouldn't be considered such an outlandish idea, and being scared of it is causing stagnation and waste (looking at you, Electron). The code here is only a couple of thousand lines per platform; surely only a small fraction of the entire code base.


I'm not sure how much of it is people being (irrationally) scared vs. looking into native APIs and making the call that it just isn't worth it, given how much messing around you have to do to get basic functionality working vs. the web where you can throw a UI together very quickly to validate an idea.

I've looked into native Linux development a few times, for example, and haven't even been sure what's the best toolkit to use. It feels like you'd have to invest quite a lot in a particular toolkit to even see if it can do what you need, coming fresh from web dev like a lot of people who go for Electron obviously are (myself included).


Sure, you can get stuff out faster by using a web view, but it will suck. It's the usual conflict between speed of development vs control. In the 90s we had Visual Basic for that, but if you were serious about quality you would use something lower level.

Linux is kind of a special case because its ancient ancestry and open philosophy means it doesn't offer standard UI components at all (and with Wayland, there's not even a standard API for creating windows). You either draw the pixels yourself on the screen or you use some library for it. But if you're targeting primarily KDE you would use QT, and if you target primarily Gnome you use GTK.

With MacOS and Windows there is a rich set of standard UI controls implemented by the OS, that ensure integration with the OS and a consistent look & feel. When you use a webview you lose all that.


We have a couple of blog posts digging into gpui, but here is one from just after rewriting and shipping gpui2: https://zed.dev/blog/gpui-ownership

We’ve slowly been building out gpui to be super ergonomic and fluid for us to build the kind of UI we need to.

As a designer that just picked up Rust last February it’s been really nice to have something that is so comfortable to work with without compromising our performance goals.


That's amazing, thanks for sharing this. Native desktop UIs are an area of interest for me so this will be an exciting read for me


I hope they add UI support for proportional type. I've bounced off the editor every time I've tried it since so many UI elements end up truncated or overly wide in general because of the insistence on fixed-width font.


Hey! Nate from Zed here - have you had issues with proportional fonts in Zed?

Let us know if so - they should just work™, but would love to know if that is not the case.


I wonder if they ever considered using Qt. Not sure what the status of that is for rust projects. Sounds like it does the same as what Z is doing, mapping user interaction to os bindings and rendering the UI using the GPU.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: