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