(Re-)adding a tray icon to Rhythmbox

By: on January 16, 2012

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.

(Side note: GObject Introspection’s main claim to fame is the Gnome Shell, the major feature of Gnome 3, which uses GObject Introspection with the Javascript bindings heavily to do a lot of its work)

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).

As always, there’s Debian packaging, and I’ve even added a downloadable prebuilt .deb from the Github repo



  1. Konstantin A says:

    Hello Tom.
    I submit your code in AUR.

  2. Thanks for this. It just want I needed. Really annoying when developers decide you don’t need that feature anymore. Oh, well at least they gave us the application in the first place.

    Here’s some notes on building the debian package that might be useful to others:

    mkdir rhythmbox-tray-icon
    cd rhythmbox-tray-icon
    git clone https://github.com/palfrey/rhythmbox-tray-icon.git
    tar cjvf rhythmbox-tray-icon0.2.orig.tar.bz2 rhythmbox-tray-icon
    cd rhythmbox-tray-icon
    dpkg-buildpackage -rfakeroot
    cd ..
    sudo dpkg -i rhythmbox-tray-icon

    Might be worth adding that to the github page.

  3. Tom Parker says:

    Joesph: TBH, those are pretty much the standard “build a debian package” instructions, so I wouldn’t have considered them necessary. Most folks will either a) do the direct copy b) use my pre-existing package or c) know how to do that already.

  4. Martin says:

    thank you for this code — I use Rhythmbox with fluxbox so this is really useful

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>