You are viewing deviant_

THE MAGIC WORDS ARE SQUEAMISH OSSIFRAGE - fun with suspend and resume [entries|archive|friends|userinfo]

[ website | My Website ]
[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

fun with suspend and resume [Jul. 29th, 2006|01:22 am]
Previous Entry Share Next Entry
[music |Nirvana - Pennyroyal Tea]

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