jeffshee / hidamari

Video wallpaper for Linux. Written in Python. 🐍
https://flathub.org/apps/details/io.github.jeffshee.Hidamari
GNU General Public License v3.0
1.02k stars 31 forks source link

[FR] wallpaper-engine-for-kde-plugin integration #167

Open Mufanc opened 1 month ago

Mufanc commented 1 month ago

I'm not very familiar with Linux GUI development, so if there's anything incorrect in my following statements, I apologize in advance.

I noticed that it seems possible to embed any Gtk.ApplicationWindow into the desktop as wallpaper in this project. On the other hand, there is a KDE plugin called wallpaper-engine-kde-plugin that can render certain scenes from Wallpaper Engine as wallpapers. This project has a standalone running mode that allows Wallpaper Engine wallpapers to be rendered in an independent window. Therefore, I created a proof of concept that embeds a standalone mode QT window into a GTK window using GtkSocket. I would like to know if this method can be relied upon to achieve the integration of Hidamari and Wallpaper Engine.

Also see poc.sh

Mufanc commented 1 month ago

I have made some simple replacements to the web_player to prove its feasibility. However, due to Wayland's limitations, I had to add the GDK_BACKEND=x11 environment variable to make it work.

image image

jeffshee commented 3 weeks ago

@Mufanc Thanks for taking your time to experiment with Hidamari! It's fascinating to realize that you can embed a QT widget into GTK, which I never considered before.

However, there is also a limitation when using the embed approach, as you mentioned that it needs to rely on X11/XWayland. Also GtkSocket has been removed since GTK4. (Just to clarify, the renderer part could use other technologies, including QT. It doesn't need to share the same technology stack with the frontend, but it will be better to do so to decrease the number of dependencies.)

I intend to rewrite the renderer part in gtk4-rs (the POC is still in progress and I will make it public at some point). I might be interested in including support for the Wallpaper Engine's scene wallpaper if there is a way we can draw it onto a Gtk4 widget.

After looking at the mentioned standalone app's sources, I realize that it uses the scene backend declared here. That scene backend then uses the scene wallpaper class declared here, which is something that I believe is implemented with pure Vulkan codes without QT dependencies. (Please forgive me if I made any mistake on this statement, I had never coded in C++ before.)

I guess we might be able to use only the Vulkan part and display it in the Gtk4 widget, just like what the standalone app has done: scene wallpaper (Vulkan) → scene backend (QML, with shared OpenGL texture) → standalone app (QML Viewer).