Live data from Hacker News

Ask HN: How to make a native GUI with a modern language?

news.ycombinator.com

131–140 of 145 posts

Re: Ask HN: How to make a native GUI with a modern language?

#131

Earlier quoted context omitted.

So, my laptop is dumb for turning off the discrete GPU when I unplug it?

They didn't say discrete GPU, they said GPUs, which includes integrated GPUs.

A game engine will tell the OS to start up the discrete GPU if it is available. This is why I asked the original question. Is there some way to turn that off?

Re: Ask HN: How to make a native GUI with a modern language?

#132

Earlier quoted context omitted.

Part of me wonders why someone hasn't tackled creating an Electron runtime service, so that each installed app doesn't load what could be a shared library into memory. There's a host of complicated problems there, but if the major issue is fat runtimes it can be pared down like Chrome workers.

So... the system WebView library?

Which is what Tauri uses.

Re: Ask HN: How to make a native GUI with a modern language?

#133

Earlier quoted context omitted.

They didn't say discrete GPU, they said GPUs, which includes integrated GPUs.

A game engine will tell the OS to start up the discrete GPU if it is available. This is why I asked the original question. Is there some way to turn that off?

When initializing a GPU context you can specify whether you want the most efficient device, the fastest device, etc, for a GUI app then you would want to pick the most efficient, which is a single flag to pass in, or supply options and let the user pick which one they want.

Re: Ask HN: How to make a native GUI with a modern language?

#134
post #20

Earlier quoted context omitted.

I haven't used it myself (yet), but https://tauri.app/ looks very promising as Electron alternative. It uses the OS's browser so it doesn't have the bundle size issue you describe.

Isn’t the downside to this then that although you’re using the native browser you’re losing the whole point of Electron which is to have a consistent environment regardless of where it’s run?

Specifically Tauri uses web views that are based on Chrome or Safari on systems, and only if they don't exist by default will it package it, which somehow still ends up smaller than electron. But on Mac and Windows it is tiny, and on Linux it is still surprisingly much smaller than electron, but it is a consistent environment.

Re: Ask HN: How to make a native GUI with a modern language?

#135
post #49

Earlier quoted context omitted.

I haven't used it myself (yet), but https://tauri.app/ looks very promising as Electron alternative. It uses the OS's browser so it doesn't have the bundle size issue you describe.

I've tried it. It's a very strong effort but if you want to support Windows then welcome to hell. You'll need to ship Microsoft's new Edge runtime thing, which is a separate package. You'll either have to include that giant package in your package or download it on demand, and the latter is very brittle and will fail if MS changes their URLs or you're installing inside a very heavily firewalled (whitelisted) environm…

I don't think this is accurate as Windows 10 and Windows 11 have edge built in, as WebView2, which is used for some internal Microsoft programs now as well, and older windows systems are not supported in any way by Microsoft themselves anymore, so it seems safe to ignore them now. I've had no issues with Tauri on Windows however, and I even compile it from Linux.

Re: Ask HN: How to make a native GUI with a modern language?

#136
post #78

Earlier quoted context omitted.

JavaFX is not native, nor can it be made to look native like Swing can be made.

Why couldn’t it be native (whatever that even means)? At the end of the day, it does have a canvas you are free to draw anything on, so there is nothing you can’t imitate.

Native would be Win32 calls to draw widgets. There's a built-in Swing look-and-feel that uses this API to render widgets in Swing. Yes, you could write your own code to replicate how things look, but it would be fragile and difficult to maintain. With Swing, it's built in and already maintained.

Re: Ask HN: How to make a native GUI with a modern language?

#137
post #119

Earlier quoted context omitted.

FL Studio is written in Delphi and the UI is very snappy and modern with a lot of animations.

Delphi always had a very good and fast UI library, the only complaint in the older days was that it made for big binaries because VCL would get statically linked

Yes, but a big binary means 1MB. Nowadays a Helloworld webapp needs more.

Re: Ask HN: How to make a native GUI with a modern language?

#139
post #49

Earlier quoted context omitted.

I've tried it. It's a very strong effort but if you want to support Windows then welcome to hell. You'll need to ship Microsoft's new Edge runtime thing, which is a separate package. You'll either have to include that giant package in your package or download it on demand, and the latter is very brittle and will fail if MS changes their URLs or you're installing inside a very heavily firewalled (whitelisted) environm…

As another Windows application developer targeting enterprise users, thanks for the warning. Electron it is, I guess. Either that, or using the IE engine for web views, or no web views at all. Edit: I'm already using Electron, though I've been wishing I could move away from it.

You should verify the original commenters statements hold true in your target environment(s). Office has started heavily relying on WebView2, any enterprise using Office should have WebView2 updating working properly. Ditto for Windows 11.

Not sure what time period the original commenter is referring to, this story has developed quite a bit over the past year, even into last month - https://blogs.windows.com/msedgedev/2022/06/27/delivering-th...

Edit: and if your alternative is Electron, WV2’s fixed runtime is the same concept as Electron in a static Chromium version - https://docs.microsoft.com/en-us/microsoft-edge/webview2/con...

Post reply on HN