Open jclsn opened 5 months ago
I really like the idea and would like to implement it here too. I will be fun challenge though, I am a C++ noob and know almost nothing about how these parts of the Plasma Desktop work, or if something like this is possible at all.
When the wallpaper was dark, it would make the icons white and vice versa.
Interesting I think a feature like that would require "cropping" the wallpaper so the only checks the colors on the area where the panel is placed. Did it work like that?
For simple colors it would hide the wallpaper and if the wallpaper was too busy it would make it slightly transparent and blurred.
For the dark/light a simple "average image brightness" check could work (I think). But detecting "if the wallpaper is too busy" will require doing some kind of analysis to the image, right?
I'll have to look into how Latte handles that. Something I do remember is that it needed a custom wallpaper plugin and used D-Bus to communicate Latte with it. Did that change?
For this feature to be added I'd prefer that it works with any wallpaper type, in fact I tried that with https://github.com/luisbocanegra/kde-material-you-colors but it is very buggy and the fallback takes screenshots of the desktop with all the widgets/folders. So something else that is more accurate/performant is the goal and will benefit both projects
I cannot tell you how this was done exactly, but here are some links that should point you into the right direction:
The main work was done by this module I think . It worked quite well. Maybe you can reuse parts of the code. Unfortunately the feature was not perfect, because some things were missing from the Plasma side. Maybe we can get the Plasma devs to revisit this. Unfortunately the panel dev is not willing to implement colorizing features etc. So you have a good chance of your widget becoming the main application for achieving this.
EDIT: Ah no, seems like the link I sent you is just a wallpaper plugin. Maybe it will point you to the part of latte-dock where the magic happens though!
Unfortunately the feature was not perfect, because some things were missing from the Plasma side. Maybe we can get the Plasma devs to revisit this.
Ah yes, I remember working around this by doing the hack suggested in comment #12 here https://github.com/luisbocanegra/kde-material-you-colors/blob/a59a61a4bd1c569ed943c4e7ad77b408a7eb68da/src/kde_material_you_colors/utils/wallpaper_utils.py#L304 But as former Latte Dock maintainer says, this should be solved for all wallpaper plugins.
Currently the Plasma Scripting API depends on the wallpaper actually setting the wallpaper source, a recently added D-Bus api is able to return all the wallpaper configuration qdbus org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.wallpaper 1
(1 is the screen) so still depends on the wallpaper plugin storing it somewhere.
I think something that can be called and return a image of whatever wallpaper content is being displayed on given screen number will be enough for me, maybe doing something like qdbus org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.wallpaperSnapshot 1
that returns either some sort of url to the file or a "snapshot" of it as file descriptor like qdbus org.kde.KWin.ScreenShot2 /org/kde/KWin/ScreenShot2 org.kde.KWin.ScreenShot2.CaptureScreen
does.
The main work was done by this module I think . It worked quite well. Maybe you can reuse parts of the code. EDIT: Ah no, seems like the link I sent you is just a wallpaper plugin. Maybe it will point you to the part of latte-dock where the magic happens though!
Indeed the all the magic seems to be in these two files:
It tries to read the wallpaper from the wallpaper configuration, if can't find that then it tries to get it from the custom wallpaper plugin that sends it through D-Bus.
For the logic I was pretty close, if the source is an image it checks only the relevant area of it, and to calculate if it's busy checks if the brightness varies too much by dividing that area into other smaller chunks.
Let's try adding the detection from the wallpaper configuration first, then either we figure a way to do for any wallpaper by ourselves or get the Plasma devs to provide it for us.
I can see you are motivated :) Thank you for the effort!
Latte had a nice feature to change the opacity and icon color based on the wallpaper. When the wallpaper was dark, it would make the icons white and vice versa. For simple colors it would hide the wallpaper and if the wallpaper was too busy it would make it slightly transparent and blurred. This is a feature that I am missing in the new Plasma panel.
Are there already plans to implement something like this?