Attempt to render HTML in GTK4
With webkit2gtk and Rust
The hard part about programming is not understanding the syntax and paradigms, it is to understand the integration between libraries and build system, etc. to get anything building.
I am trying a hello world with rust + libadwaita + gtk4 and want to replace the "Hello World" label with a WebView of any sort to show example.com
GNOME Builder gives me a nice template for Hello World, but then the hard part begins. It doesn't install the right SDK I need to figure it out where to get it, can't find any videos on YouTube about it so I poke around, when I use cargo on the command line then I can build on the command line but GNOME Builder doesn't pick it up. After long poking around I found in the Settings that there is a list of SDKs which names which don't really help me to figure out which one I need:
No indication which one is already installed, there is only a [Update] button I can click to install it (again?). There are also is something called Platform and Extensions for rust. Anyway I installed everything which looked like it might help and were able to compile and run the "Hello World".
Adding a browser engine
Next step, which browser backed do I use? Probably something which is easy to use with rust, there is webkit2gtk-rs (why is there a 2 in it?) and that expects webkit2gtk installed.
Then I look at what to install:
- webkitgtk-6.0 (why is there no 2?)
In arch I can install
webkit2gtk 2.40.0 and
webkit2gtk-5.0 2.38.5 from what I understand the
webkit2gtk 2.40.0 is probably
webkit2gtk-4.0 but I'm not sure ...
After some more googling I found this blog post Posted on March 21, 2023 by Michael Catanzaro - WebKitGTK API for GTK 4 Is Now Stable which explains the differences between those weird version numbers, the 4, 5 and 6 are API version numbers and the 2.40 version is the software version which supports all of those APIs depending on some build parameters.
It seems that I'm a bit too early to try it, the blog post explains that you need to patch different things and so on before you can use it, etc.
But because this is my first attempt of building a rust app, I feel this will not work because I will never know if the problems I'm facing are because of the for me unknown Rust environment or the language or the not ready yet Webkit integration. Even if I would get webkit working, there is another layer of connecting it to Rust which also seems not ready yet. webkit2gtk-rs CHANGELOG only mentions bumping from 4.0 to 4.1 about 4 month ago. So I guess it'll take quite some time before they get 6.0 working.
Tente renderizar html em gtk4 com webkit2gtk e ferrugem – linux-BR.org
5 Simple Techniques For Pin up casino