Wanting to contribute a daily wallpaper plugin: where can I start?

I started using Fedora KDE a couple of months ago and am a fan. I have no coding background, I have only scripted things a handful of times and have basic css knowledge. I would love to learn though and was hoping for guidance in making a daily wallpaper plugin. I already have the hosted images, one for each day of a year, and would like to learn how to put this together.

Are there any resources I should seek out to learn how to make this a reality? Is the code for the existing daily wallpaper implementations available to either utilize or learn from? What steps would I need to take to get the plugin onto the “New Wallpaper Plugins” section?

Any guidance would be greatly appreciated.

Hi, and welcome! The “Picture of the Day” wallpaper plugin that ships with Plasma can be found in the kdeplasma-addons module, have a look at the source code here: wallpapers/potd · master · Plasma / Plasma Add-ons · GitLab

It looks like each POTD provider is built as its own plugin - theoretically, if you can build kdeplasma-addons with kdesrc-build and add a new plugin to the providers folder, then you should be able to simply copy the resulting plugin .so file to your system’s potd folder (wherever Qt plugins are located for your distro) and get the extra entry to show up in Plasma’s wallpaper settings.

Have a look at some of the existing plugins for inspiration - they all use C++ (with .cpp and .h files) to do the actual fetching, declare the plugin metadata with a .json file, and add all of that to the build with a two-liner entry in the CMakeLists.txt file in the providers folder. I looked at the Bing plugin and it’s relatively straightforward what it’s trying to do. Without a coding background though, you may have to learn a few things to get the hang of it.

Work on first building the existing module. Once it’s built successfully, see which one of the existing provider plugins is the closest to your image hosting setup, copy that into a new set of files (plus CMakeLists.txt entry) and modify the code accordingly.

Good luck!

2 Likes

Alternatively, you can also look at the code of third-party wallpaper plugins on KDE Store, which is where “New Wallpaper Plugins” is coming from. Each plugin’s store page has a Download button that gets you an archive (tarball) of the respective wallpaper plugin. Plasma will generally install these into a certain folder, on my system that’s $HOME/.local/share/plasma/wallpapers/<plugin-id>/.

These wallpaper plugins are generally coded with QML, which doesn’t need to be compiled like C++ and is generally a little more approachable given that it uses JavaScript instead of C++ for its embedded logic. So that’s more convenient for experimentation.

The downside is that there doesn’t seem to be a “daily wallpaper” kind of plugin among the current ones I see, so you’d have to come up with some of the QML code from scratch as opposed to modifying the code of something similar.

It’s your call which approach is less painful - dealing with C++ plugins and CMake builds in kdeplasma-addons but having code mostly set up to do the right thing, or getting the tighter feedback loop and less scary JavaScript code of QML files but having to make larger changes because no similar QML plugin seems to exist.

One thing to keep in mind would be that if you make changes in kdeplasma-addons, the preferred way of getting your plugin shipped would be by submitting a merge request on KDE Invent to get it shipped with Plasma directly. This will involve some additional scrutiny for code and wallpaper licensing (but also learning opportunites). Whereas QML wallpaper plugins on the KDE Store can be submitted by any third party, but need to be discovered and downloaded by each user individually.