One of the features I used to particularly like about Rhythmbox was it’s ability to minimise to tray. This meant with a simple click of an icon I could briefly bring it up on my current workspace to play/pause and then hide it again. However, in the new 2.90.x releases, the upstream has decided to remove this, which has been annoying me over the last few days.
Luckily, Rhythmbox has a nice plugin system, so I can fix that. Having done this sort of thing a little bit before, but not for a while, I started at the plugin writing guide. As it turns out, in the 2 weeks between starting writing this and doing this post, they’ve updated that guide a lot, but at the time
it was very out of date. My major guide was in fact the ‘Remember the Rhythm’ plugin off of the 3rd party plugins list.
The top of the plugin may look a little unfamiliar to anyone whose done any Python Gtk programming before, and have many of you wondering what this “gi.repository” thing is. “gi” in this case stands for GObject Introspection, a new and shiny way to interface between object-orientated C written with GObject (i.e. a lot of things in the Gnome project) and your favourite scripting language. More specifically, instead of writing language-specific bindings (although there can be language-specific extensions), a library writer can now just write for the GObject introspection system and all of the fans of language Foo can just write bindings for the introspection stuff, and everyone gets to do less work. This isn’t quite introspection in the same way as most people know it, as the tool starts from scraping C header files (plus some custom overrides), but it’s still a nifty little item.
The other new item there would be the Peas system, which is a general-purpose plugin system for GObject-based systems, leveraging the GObject Introspection stuff to let you write multi-language plugins (although Rhythmbox always had Python support).
Other useful items along the way were the Python Gtk+ 3 tutorial for the basics, and the main Gtk+ manual (written for the C interfaces, but you can kinda figure things out). You’re also going to need the Rhythmbox developer manual and for when you want to do funky things like a play/pause icon, you’ll need the Python Cairo bindings (or the relevant PyGtk FAQ entry when you get stuck).