Hi Guys:

Is there a way to cause the operating system automatically notice I just turned off the external speakers power?

I mean, when I disconnect the speakers from the power outlet (I keep the audio plug inside the audio jack), I am looking for a way to let the operating system detect the event and invoke a script.

My motivation is, I want to kill Rhythmbox radio streaming when I turn off the external speakers, without turning on the monitor and kill it manually. This way I can release the bandwidth for other applications.

Any idea?