An Overview of the Problem
Similarly, we've been adding more and more scripting options and features in Plasma Desktop and Netbook. KWin is now quite scriptable (why isn't that blog entry on Techbase as a tutorial? :), and the Plasma Shell Scripting now supports "snippets" that are stored in nice little packages. This isn't unique to Plasma, either: Kate, Amarok and many other KDE applications have also gained similar scripting support.
Problem is: we don't have a good way to distribute these add-ons. There's opendesktop.org, but there are four major downsides:
- Creating a new download type (e.g. a feed for share DataEngine backends) there means making a request of the opendesktop.org crew; they are usually quite responsive, but it's still one more set of human roundtrips
- Anyone can post additions there and there is no way for an upstream such as Plasma to approve select items
- It, understandably, remains a manual process where one has to package the results up, upload them, etc.
- It is driven by non-free software
Even without the last matter, the first three practical matters are not great and probably not easily solvable. opendesktop.org is meant to be a social networking driven community creation site, and it does a great job of that. In this use case, however, that just isn't what we need or want.
My dream solution
So I sat down and sketched out what my dream solution would be, namely:
- A git repository to hold the add-on files
- A simple config file in the repository in which I could define feeds
- Open Collaboration Service compatible feeds automatically created from this, so it can be used via knewstuff (aka "Get Hot New Stuff")
This would make the workflow to start a new feed for the share DataEngine (as an example):
- Edit the providers config file in the repository with:
- Make a directory called "org.plasma.share" in the repository
- Commit the addons in org.plasma.share, each in their own sub-directory
- Push the changes to the main repository
Adding a new addon would mean adding a new directory and committing. Updating an addon would mean editing the files and committing. Simple, easy and fits the development workflow we have seamlessly: it's the same way we write any of our code.
I carved out a few days to work on this idea and finished up the last bits today. I called it synchrotron. It goes with the whole particle physics naming theme in Plasma and sounded like something out of an awesomely bad sci-fi movie. Win-win, really.
You can find the code, currently in what I'd consider to be "alpha" state in my scratch space on git.kde.org. (I'll be requesting a move to playground and starting a review so that it can be moved somewhere more permanent later.)
Synchrotron consists of:
- a PHP script that scans a local clone of the source git repository and builds feeds, packages and a database cache (currently using PostgreSQL) of the providers and content
- a set of pretty simple PHP scripts that power the (minimal) OCS feeds, allowing for listing and downloading only (no voting, no uploading, etc. supported)
All in just a hair over 2,000 lines of code, not that I tried very hard to keep things minimal, though. Huzzah!
Now I just need to get some code review, put it all on a KDE server somewhere, start the source git repository and start having fun.
The path forward
If you found yourself thinking, "I could make that so much better!" or "I could totally write a bit of PHP for that item in the TODO file!", please don't hesitate to get involved. Send me patches, clone the git repo and get hacking .. I am not a web developer and PHP is not my specialty, so I'll be the first to admit that there are problem a bajillion ways to improve on what's there. Some features, like i18n for names, simply aren't implemented yet.
If you found yourself thinking, "I could so use that for my KDE application!" please get a hold of me by email or on irc and let's coordinate. I think KDE Games, KDE Edu, KWin, Kate, Amarok and who knows how many other KDE application teams could benefit from something like this, and I'd love to share an addons repository with all of them! :)
There are some interesting possibilities for improvement in knewstuff, too. For instance, it would be great if the Share Plasmoid could check on startup for addons in Synchrotron and either grab them automatically or offer to. It would also rock to be able to check periodically for updates to installed addons and have them drawn down automatically.
So in some ways Synchrotron is just a beginning, even though its functional already on my laptop and does what I set out for my "dream system". If you're interested in helping out, don't hesitate to clone the repository and get in touch.
Right now, though, I'm off to make some dinner before popping off some requests to KDE's sys admin super hero league to get the Synchrotron spinning. :)