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

>(no JS, or at least optional) IMO reply

At this point why not focus on some actual GUI toolokit, like write a Qt clone in Rust, for real world apps we don't need all the CSS and HTML crap, you need simple layout, GUI components and an option WebView you can embed in the app if needed. Probably there is no commercial interest to pay professional developers with real experience to implement this.



HTML and CSS, while not perfect, are still the best tools I've found to create a pleasant UI. Other libraries like Qt do work, but it's more difficult to get things looking exactly how you want them to look.


It is definitely slightly subjective, but come on. God damn winforms were more productive than HTML+CSS hooks you have to go through. In sane frameworks you have proper layouting (not some third party css library with ton of boilerplate to do something like vbox/hbox) and easy customizability through inheritance (eg. try to create a datepicker in HTML.)


Hell even Swing had good layouts decades before CSS caught up with things.

WPF has amazing layouts.

CSS is irritating as hell. Even modern CSS, justify-content, justify-items, seriously?

Flex has so many weird edge cases it is overwhelming. I have used flex type systems in other frameworks that worked 10x better, while Flexbox is way better than what existed before on the web, it is still and endless source of frustration.

And yes, Winforms is 100x more productive than HTML. Awhile back I designed a fully functioning UI in Winforms to get an idea what I wanted my website to look like. I hadn't used Winforms in years. Took me less than a day to get a UI up and running with data binding to my backend and all the features implemented.

TWO MONTHS of web dev later I had the same thing working in a browser.

Now the browser was styled, and responsive, sure. But 2 months vs 6 hours. The loss of productivity there is insane.


CSS has too much old crap, how many ways you can center a thing? How many ways you can horizontal align some stuff? There should be only 1 way and that way should not have hacks like use negative margins.

What a Qt or other similar frameworks gives you is consistency, all components in all apps will look and work the same (with the exception of customized ones). This means you can focus on UX and not on bad design. My experience is that some bad designer will force his opinion on the users, will force his preferred fonts, font sizes and font colors on the users(making text hard to read), will disabgle text selection for some weird reason, will fuck with the scrollbars because the native ones are ugly etc.

For a working app that is not a music player you don't need the "power" of css, say you seen video games have a small Launcher/config window that hase buttons,drop downs, checkboxes , I noticed those use Qt or Windows Forms. I am also noticing that modding tools , open source tools (that are not GNOME) also focus on functionality and you will not see buttons with round corners, fancy fonts and animated borders.

IMO Electron advantage is not his the "powerfull"css and html and it is that you can reuse the existing node ecosystem and existing web developers and the alternatives are also lacking for higher level languages (GTK is shit IMO)


> There should be only 1 way and that way should not have hacks like use negative margins.

There is: flexbox and grid. All kinds of alignment can be done with basically a one-liner in both layout systems, without any hacks.


>There is: flexbox and grid. All kinds of alignment can be done with basically a one-liner in both layout systems, without any hacks.

You missed the part with "there should be ONLY 1 way". I know about flex and grid, this are new and thanks the gods we finally we have something decent (not good).

Flexbox is great I wish to magically remove or magically fix all the code that does not use it and instead uses "float" or other shit.

You would say "don't use the other old shit" but my point was that we need a GUI framework that does not have 1 million lines of code for supporting this old stuff. If we really want to use HTMl a language for documents to write GUIs then we should make a new version that is the modern subset of html and css, where you ONLy have 1 way to do a thing (remove or limit the use of float, don't support all boxing models, simplify the layout rules so I don't have to google and find that to make something to work I have to set min=width=0 so the css engine follows a different path and does the correct thing)


I'm curious if you've found any GUI frameworks for any OS, in any language, that have ripped out all their legacy code and/or the design tradeoffs and hacks their legacy code required.


>I'm curious if you've found any GUI frameworks for any OS, in any language, that have ripped out all their legacy code and/or the design tradeoffs and hacks their legacy code required.

Yes, Qt4 is not compatible with Qt3 , Adobe Flex4 was not compatible with Flex3 , I only used at that time this new versions and did not had to work or learn the old stuff. Old projects continued to use the old stuff and continued to work.


This is obviously a different camps kind of thing, but I don't think you're supposed to make everything look exactly pixel perfect to how you want it, you're supposed to follow the look and feel of the OS with native controls and such.

I understand both, I don't agree with either more than the other.


Qt allows the use of (sort-of) CSS for customizing controls.

https://doc.qt.io/qt-5/stylesheet.html


HTML and CSS are probably the best tools for styling, layout and accessibility. Compared to other UI platforms though, their built-in controls are missing, limited, and inconsistent between browsers. See https://open-ui.org/ for an example of what controls could be improved and added.


People are doing that too. https://sixtyfps.io/ is basically a Qt clone in Rust, actually developed by previous Qt developers.


I don't think "basically a Qt clone" is a fair framing, in both directions. (sixtyfps aims to cover things Qt doesn't, Qt does things sixtyfps doesn't and won't for a long time if at all)


I have written a full OS like GUI in JS proving that it can be tiny and memory efficient. The GUI part of the application is about 2k loc across two JS files plus CSS and includes full file system display and navigation. It’s all vanilla JS and static DOM methods so it’s as fast and memory efficient as the browser allows.

It’s amazing how fast the browser can be for this (and tiny) when you aren’t using querySelectors, vDOM, or event listeners.


Curious, what do you write that is 'OS like GUI' that doesn't require querySelectors, DOM and event handlers?

How do you handle the nuances of GUI and input handling?


Content is dynamically generated in response to user interactions. For example a user clicks a button to navigate to a parent directory the new directory contents are fetched and populated into DOM artifacts using a function which recognizes the returned object as a microservice instance.

Instead of querySelectors I use things like getElementById, getElementsByClassName, getElementsByTagName, and some custom DOM navigation utilities I wrote for this application like getAncestor, getModalsByModalType, getNodesByNodeType, and so forth.

You don't need any kind of framework or fancy wiring to work with events. You always know what you are working with from within the event handler, because event handlers receive an implicit event object as their first argument. From that there is event.target which returns the element the handler is assigned to or event.currentTarget which returns the element the user interacted with that fired the event after bubbling.

State management is also just as easy.


I believe the interest is there, it's just not as easy as it seems: https://raphlinus.github.io/rust/druid/2020/09/28/rust-2021....


egui is a really fantastic Rust GUI toolkit, best I've used in any language


Because layout, rendering, and accessibility are not easy problems to solve and already handled by browser engines that come with your OS.

It's more work to reinvent those wheels than bind to them.




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

Search: