Live data from Hacker News

Building a hackable editor in the browser

bjenik.com

51–60 of 74 posts

Re: Building a hackable editor in the browser

#51

Earlier quoted context omitted.

For that we’ll need an adequate cross-platform (-ish) way of doing UI. I’m not a fan of React Native, but it seems to be the technology we’re looking for, though it doesn’t seem to be as ready for the desktop yet. An all-native solution on top of a powerful modern language (rust?) would be ideal, but that doesn’t seem to be the direction things are moving. We’ll probably end up with Flutter/Native.

I've been thinking a lot about this lately and I'm trying to compile some information on how others think it should work. Can you elaborate on what you mean by an all-native solution on top of a powerful modern language? The way I see it is that a new toolkit like GTK or Qt is required in the target language.

> The way I see it is that a new toolkit like GTK or Qt is required in the target language.

The way i See it is that a new toolkit like GTK or Qt is required in C so that it can interface with any language as to avoid unnecessary duplication between languages (it is much easier to convince people switch toolkit than switch programming languages), ensure no language-specific indirect dependencies (especially if it is to included in OSes like OpenBSD that are traditionally C oriented) and with a stable backwards compatible ABI to avoid wasting the time and effort of whoever maintains the bindings (no need to rewrite them every few years), whoever decides to learn the new API (no need to learn something new for doing the exact same thing as before, only now in a slightly different yet incompatible way) and perhaps hopefully become a "standard" API people can target on Linux without having to carry 29892482923TB of libraries for a trivial app since you cannot rely on anything outside of X11 being there (and if GNOME people have their way, you wont be able to rely on even that). And of course all that in a permissive license that leaves everyone happy.

Now guess how likely all of this is going to happen.

Re: Building a hackable editor in the browser

#52
post #50

Earlier quoted context omitted.

"Native" in context of UI toolkits is "using system-provided UI controls through system APIs". The opposite of that is drawing your own controls, which then usually don't integrate well with the OS and don't support the interoperability and accessibility features that are expected of UI controls on that OS.

That's what native used to be, but nowadays it's "not electron". Qt or wxWidget apps are considered native as well.

So Java is native now?

I think a simpler and easier approach is to simply wait until the inevitable next desktop disaster so that we can call Electron native.

Re: Building a hackable editor in the browser

#53
post #45
post #11

Earlier quoted context omitted.

I write moderately complex web apps and I have to say 200ms for a user interaction sounds like far too long. All apps regardless of where they're running should be managing a solid 60fps, which gives you a budget of 16ms for the UI to react to a user event. Obviously starting the app is going to take longer, especially from cold, but if you ignore things like DNS resolution and download time then 200ms is more than e…

It shouldn't be obvious that startup is slower and I didn't mean UI reaction, but the more broader reaction time. For example from typing a location and hitting enter, it should take something like Google Maps zero point two seconds at most to completely load the page and be done with everything. The user shouldn't have a concept of "loading time" and that includes starting the application.

It's funny you should mention google maps, as that's recently regressed to semi-unusable in firefox.

Re: Building a hackable editor in the browser

#54
post #51

Earlier quoted context omitted.

I've been thinking a lot about this lately and I'm trying to compile some information on how others think it should work. Can you elaborate on what you mean by an all-native solution on top of a powerful modern language? The way I see it is that a new toolkit like GTK or Qt is required in the target language.

> The way I see it is that a new toolkit like GTK or Qt is required in the target language. The way i See it is that a new toolkit like GTK or Qt is required in C so that it can interface with any language as to avoid unnecessary duplication between languages (it is much easier to convince people switch toolkit than switch programming languages), ensure no language-specific indirect dependencies (especially if it is…

> and perhaps hopefully become a "standard" API people can target on Linux without having to carry 29892482923TB of libraries for a trivial app since you cannot rely on anything outside of X11 being there

so, uh, what would you depend on ? at the bare minimum you would need, for a gui toolkit :

- dependencies to X11 (xcb) and wayland (and cocoa and win32)

- dependencies to xkb, etc.. for keyboard handling

- dependencies on ICU for unicode text handling

- dependencies on freetype, fontconfig, harfbuzz, pango, etc... for font rendering

- dependencies on GL to allow your users to have a GL viewport, and potentiall on a software implementation of GL on windows because yes, even in 2019 this is still a problem on some user's computers

- dependencies on cairo, skia, QPainter, or something like that to provide a canvas-like API

- dependencies on libinput because that's the modern way to get mouse input on linux

- you are going to want a library of useful datastructures that aren't provided in C -> dependency to GLib or something else

- dependencies on libpng,jpeg, etc.... because you want your users to be able to have images in their app

- dependencies on dbus to be able to provide desktop notifications, etc

and you aren't even starting to match all the useful functionalities of GTK & Qt

Re: Building a hackable editor in the browser

#55
post #50

Earlier quoted context omitted.

"Native" in context of UI toolkits is "using system-provided UI controls through system APIs". The opposite of that is drawing your own controls, which then usually don't integrate well with the OS and don't support the interoperability and accessibility features that are expected of UI controls on that OS.

That's what native used to be, but nowadays it's "not electron". Qt or wxWidget apps are considered native as well.

Qt is decidedly not native, but can attempt a "native look-and-feel".

wxWidgets actually wraps native GUI widgets though...

Re: Building a hackable editor in the browser

#56
post #50

Earlier quoted context omitted.

"Native" in context of UI toolkits is "using system-provided UI controls through system APIs". The opposite of that is drawing your own controls, which then usually don't integrate well with the OS and don't support the interoperability and accessibility features that are expected of UI controls on that OS.

That's what native used to be, but nowadays it's "not electron". Qt or wxWidget apps are considered native as well.

> That's what native used to be, but nowadays it's "not electron".

This makes me sad. Coherent UI is a very important point to users IMO. Users can assume that some special feature from App X will also work on App Y.

(It also allows OS/GTK/Qt devs to enhance UX without application modification.)

For example, in macOS Cocoa, textboxes have universal readline-esque keybindings (and is configurable globally) which, as an Emacs user, very, very useful.

Most Mac apps use Cocoa as the GUI toolkit, so basically all kinds of apps can benefit these keybindings.

Another example of this directly benefiting users is the addition of tabs in macOS Sierra(I’m not sure about the exact versions :-().

macOS Sierra added tabs to Cocoa apps, and applications could get the feature without additional modification. (I’m not sure if it’s absolutely none or if recompiling was needed, but I think it’s the former.)

I could use tabs in any application, with the same look-and-feel, in all apps!

And, don’t forget accessibility here!

Stories like these are mostly only macOS; since Windows apps usually just re-invent all kinds of UI elements, while Linux’s GUI toolkits are super-fragmented. (GTK vs Qt is one thing, and there are lots of other options!)

We really should be trying to use the native GUI toolkit (and that is why I’m hoping cross-platform native UI libraries like libui succeed), not using some Flutter-esque library that draws everything from scratch.

(BTW, AFAIK wxWidget tries to get this right and tries to draw things using the native toolkit.)

Re: Building a hackable editor in the browser

#57
post #48
post #21

Earlier quoted context omitted.

What desktop programs do you use that take fewer than 0.2 seconds to start?

fyi, I'm on Linux. Here's a list: ranger, urxvt, sxiv, w3m, xev, vim, feh and qutebrowser.

vim is slow to start? Have you checked the SMART stats on your drive lately?

Re: Building a hackable editor in the browser

#58

Earlier quoted context omitted.

For that we’ll need an adequate cross-platform (-ish) way of doing UI. I’m not a fan of React Native, but it seems to be the technology we’re looking for, though it doesn’t seem to be as ready for the desktop yet. An all-native solution on top of a powerful modern language (rust?) would be ideal, but that doesn’t seem to be the direction things are moving. We’ll probably end up with Flutter/Native.

I've been thinking a lot about this lately and I'm trying to compile some information on how others think it should work. Can you elaborate on what you mean by an all-native solution on top of a powerful modern language? The way I see it is that a new toolkit like GTK or Qt is required in the target language.

I meant something like SwiftUI, but as an abstraction over platform-native components like React Native. By Flutter/Native I meant Flutter ported to a language without garbage collection and with ability to easily call into C libraries.

Re: Building a hackable editor in the browser

#59
post #10
post #9

Earlier quoted context omitted.

Probably because your desktop apps are bloated, too. Any software that needs longer than zero point two seconds reacting to user action (this includes starting the program) should be improved upon.

I think the only native apps that I use are Steam, Unity, Photoshop, SourceTree and VSCode. Out of those the only "fast" one is VSCode, which is actually written in JS. Even though you mentioned the browsers being "bloated", for me Chrome always starts up instantly and I have no responsivness issues when browsing sites, playing browser games or using browser apps.

VSCode is anything, but "native".

Re: Building a hackable editor in the browser

#60

Earlier quoted context omitted.

I've been thinking a lot about this lately and I'm trying to compile some information on how others think it should work. Can you elaborate on what you mean by an all-native solution on top of a powerful modern language? The way I see it is that a new toolkit like GTK or Qt is required in the target language.

I meant something like SwiftUI, but as an abstraction over platform-native components like React Native. By Flutter/Native I meant Flutter ported to a language without garbage collection and with ability to easily call into C libraries.

Maybe libui can be of use? As far as I know they wrap native element but I have not looked into it much.
Post reply on HN