5 Dec 2008 pjones   » (Journeyer)

fun with suspend and resume

Plenty of times I've suspended my laptop with my headphones on, while listening to music. Of course when I resumed, the music would still be playing. This is obviously not preffered.

So tonight I wrote some code to fix it. It's way more complicated than should be needed. Rhythmbox talks to dbus, but only to the session, not to the system. So the suspend/resume scripts can't talk to it[1]. So, since the obvious 5 line shell script won't work, I had to write a rhythmbox plugin that listens on dbus, and then make the shell script talk to that.

Rhythmbox's python binding method is pretty much backwards from what you'd expect, and it registers itself through an __init__ method call, rather than the obvious way. That's a little weird at first, but using dbus's python bindings are like trying to stab yourself in the foot with a rubber ball. The introspection methods are entirely useless (actually, they don't provide any introspection at all).

So, anyway, here's a tarball. I'll look at packaging it somewhere later.

[1] We should really make some infrastructure to fix this recurring problem...

Syndicated 2006-07-29 05:38:12 from THE MAGIC WORDS ARE SQUEAMISH OSSIFRAGE

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!