Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I resume my laptop and had radiotray turned on it starts playing again (from buffer) while I'm on the lock screen. This gets really annoying when I'm somewhere it should be quiet (library, train etc.). It would also be nice to have some delay in resuming radiotray playback after unlocking the screen to be able to react to the situation I'm in.

How do I prevent that behaviour (ok, besides turning radiotray off before suspending)?

share|improve this question

Running 10.04, as a workaround to avoid this quite annoying behaviour, I put together the script below and saved it as /etc/pm/sleep.d/13_radiotray.
(In terminal: gksudo gedit /etc/pm/sleep.d/13_radiotray, enter/paste the script code, save the file and finally make it executable with: sudo chmod +x /etc/pm/sleep.d/13_radiotray.)

As you can see, what it does is: if radiotray was running on suspend/hibernate, it gets killed on resume/thaw and then restarted in "idle" mode. This works OK for me and my needs...

(I don't know if the numbering (13...) of the script is "OK", if the final "exit $?" is necessary - or of any use at all? - but at least it works perfectly for me...)

# /etc/pm/sleep.d/13_radiotray

case "$1" in
    # kill radiotray if it's running...
    if pgrep -f /usr/bin/radiotray > /dev/null ; then
      pkill -f /usr/bin/radiotray
      # ...and then restart radiotray (idle)
      # If it doesn't work with 'tty7', try '(:0.0)' or '(:0)'...
      DISPLAY=:0.0 su `who | grep 'tty7' | awk '{print $1}'` -c "radiotray > /dev/null &"

exit $?

Edited 2012-11-03: changed the "DISPLAY=: ..." line (see comment below) /mikwie

share|improve this answer
For me the script doesn't get radiotray back to systray. It's running when I look at the system monitor but the indicator icon isn't appearing. Additionally there's still playback for a very short time after resuming. Don't you have the same issues? – joschi Oct 13 '12 at 7:31
@joschi: sorry that I haven't been able to answer/comment earlier. No, I haven't experienced these issues on my Ubuntu 10.04 single-user system. By the way, error messages related to radiotray or 13_radiotray should show up in /var/log/pm-suspend. Having realised that the sed command (not mine, found it somewhere) doesn't work with all possible usernames, and that "grep (:0)" doesn't work with e.g. 12.04, I changed the script (edited the original post). Try it - and if this still doesn't work for you, please let me know - I will do my best trying to help you. – mikwie Nov 3 '12 at 19:23

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.