wailsapp / wails

Create beautiful applications using Go
https://wails.io
MIT License
25.08k stars 1.2k forks source link

Support for QT? #2793

Open firelizzard18 opened 1 year ago

firelizzard18 commented 1 year ago

Is your feature request related to a problem? Please describe.

I'm curious how much work it would be to update Wails to optionally build against QT and QtWebEngine instead of GTK/WebKit GTK, on the scale of "That could be done with one MR" to "That would take months", and whether it might be feasible for me to contribute this change.

Describe the solution you'd like

I'd like to build a Wails app for Linux using QT instead of GTK. Partially due to #2792 and partially because I'm using KDE and it would be nice to have the option of using QT.

Describe alternatives you've considered

N/A

Additional context

No response

leaanthony commented 1 year ago

I don't know the answer off hand but moving away from webkit2gtk would be amazing. The fact that Tauri still uses it suggests it's not simple. I'd fully support this effort though.

Psycomentis06 commented 1 year ago

Tauri team have been away from any chromium related tech. and this is what one of the creators mentioned. Tauri was built for Linux with FSF guidelines in mind that's why they didn't chose chromium and went for WebKitGtk (for other operating systems users don't care much about FSF so they used what's available for the OS). Tauri team wants to switch from WebKit as well that's why they announced on Twitter That they are collaborating with Servo team to make a stable webview provider for all platforms.

PS: I'm using the KDE Falcon browser every now and then which is based on QtWebEngine and I can confirm that i had some problems with some websites that uses CSS to toggle menus/themes ... AKA most Tailwind based UI libraries. So i guess your best choice for now is WebKitGtk until Servo becomes a thing.

firelizzard18 commented 1 year ago

@Psycomentis06 Beyond non-technical reasons like licensing and FSF/not supporting the monstrosity that is Google, it's not clear to me that either QtWebEngine or WebKit GTK is the better choice. WebKit GTK has its own problems, especially #2792. It seems to me that Wails could easily allow the developer to select between WebKit GTK and QtWebEngine via tags (if someone added QT support).

Psycomentis06 commented 1 year ago

I agree with you It's good to give developers more options but it's more work. I hope if there is someone interested to make it happen.

Blquinn commented 11 months ago

Is there any reason to not just replace gtk with qt? Aside from the ethical browser wars debate. Seems like most users will get a much better experience with a Qt and I'm pretty sure more people are actually using KDE than gnome anyway, they'll already have Qt installed. (I suspect most gnome users have it installed too)

The tauri team is closing related issues and quite literally crossing their fingers that webkit performance will improve. No offense to their efforts intended, but it just doesn't seem like they believe there is a real issue.

Also like others have said there's actual rendering and usability issues as well.

firelizzard18 commented 11 months ago

I don't know the answer off hand but moving away from webkit2gtk would be amazing. The fact that Tauri still uses it suggests it's not simple. I'd fully support this effort though.

@leaanthony (comment above) clearly supports it, at least in theory. IMO supporting both and letting the developer decide would be best. But regardless, someone has to write that code.

leaanthony commented 11 months ago

There is also https://github.com/SerenityOS/serenity/tree/master/Ladybird

Blquinn commented 11 months ago

I made a quick proof of concept for a minimal go qt binding here https://github.com/Blquinn/go-qt-binding

I would be interested in providing a qt binding.. I looked through the current linux code and it doesn't seem too difficult. I just can't figure out how to actually build the project and get something running with the locally built wails code. Is there any info on that? Can someone point me in the right direction?

leaanthony commented 11 months ago

I made a quick proof of concept for a minimal go qt binding here https://github.com/Blquinn/go-qt-binding

That's incredible!

I would be interested in providing a qt binding.. I looked through the current linux code and it doesn't seem too difficult. I just can't figure out how to actually build the project and get something running with the locally built wails code. Is there any info on that? Can someone point me in the right direction?

If you ping me on discord, we will absolutely help you with this 👍

Blquinn commented 11 months ago

I was actually able to get a test app running (sort of) so I should be able to make some progress. I've also joined the discord though, thanks!

Side note -- the gtk4 version of webkit (webkitgtk-6.0) has been considered stable for a few months now maybe it would be worth upgrading that, or easier than a qt port. From what I understand the performance of the gtk4 version is greatly improved because they're both hardware rendered and gtk is now able to share a framebuffer with webkit... or something like that I'm not super well versed on that.

leaanthony commented 11 months ago

Would be happy to upgrade to v4. Is it installed by default on most distros? We need to think about graceful fallback.

firelizzard18 commented 11 months ago

If the UI abstraction layer is organized as or could be refactored into 'drivers' for different operating systems and/or libraries, it should be feasible to create drivers for GTK3, GTK4, and Qt, and automatically choose one and/or let the user decide.

Blquinn commented 11 months ago

I spent some time implementing a proof of concept for the qt frontend here https://github.com/wailsapp/wails/pull/3024

For now, it just opens a window with example.org, but it handles most of the application life cycle and threading stuff pretty well already.

Let me know what you all think!

Would be happy to upgrade to v4. Is it installed by default on most distros? We need to think about graceful fallback.

I'd say gtk4 is installed on most distros, I'm not sure about the new webkit. I don't think it's made it everywhere yet, definitely not like debian etc. I think you'd likely want to have it as a build tag type situation and support both for a time.

leaanthony commented 11 months ago

I actually think this is a packaging issue. If we pakcage as AppImage/Flatpak/snap then that guarantees the correct version being available.

leaanthony commented 11 months ago

If the UI abstraction layer is organized as or could be refactored into 'drivers' for different operating systems and/or libraries, it should be feasible to create drivers for GTK3, GTK4, and Qt, and automatically choose one and/or let the user decide.

Build tags should be sufficient I think.

PylotLight commented 11 months ago

I actually think this is a packaging issue. If we pakcage as AppImage/Flatpak/snap then that guarantees the correct version being available.

Vote #1 Flatpak

firelizzard18 commented 6 months ago

I actually think this is a packaging issue. If we pakcage as AppImage/Flatpak/snap then that guarantees the correct version being available.

Being able to distribute my app as a single executable is a huge win for me. App packages are useful but I don't want to be forced to use them.

leaanthony commented 6 months ago

For Linux, you have no choice. You aren't currently going to have a single binary with all the dependencies inside and a desktop icon to launch it. The app bundles are trying to solve that.

After 30 years, the Linux desktop gods still haven't been able to standardise on a solution for this and many other issues. It's painful beyond belief.

firelizzard18 commented 6 months ago

I mean, as a single binary that links to shared libraries on the user's system. I would be quite disappointed if Wails moved to a packaged-app-only model.

leaanthony commented 6 months ago

If you can come up with a way to make that work, we'd be all ears. What if the host doesn't have QT installed, or the right version of QT?

firelizzard18 commented 6 months ago

I'm fine with the status quo: the user has to have gtk/qt/whatever installed. If there was a Qt frontend, I might start distributing separate binaries. If Wails was updated in such a way that made it impossible or infeasible to not use AppImage/Flatpak/snap/etc, I'd likely move to some other solution.

leaanthony commented 6 months ago

Nobody has suggested we're doing that.