7

I was wondering whether it is possible to pause a music player (in my case Rhythmbox), by pressing a button, while the screen is locked. I would assume no, but I thought I'd ask.

A short example: If the screensaver goes on the music continues. But lets say somebody comes in my office, I don't want to type in the password, but just hit a button to pause it. And ideally of course play again once I'm alone.

Is there a program that would allow something like this? I'm using Fedora16.

Edit thanks to pbm for the solution. Here is my actkbd.conf (using Ctrl+Alt+P):

25+29+56:::su MyUserName -c "dbus-send --type=method_call  --print-reply --dest=org.gnome.UPnP.MediaServer2.Rhythmbox /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause"
  • I find the question slightly ambiguous (as, maybe, did the previous commenter): do you want "when screensaver goes on, music pauses; when screensaver goes off, music resumes" or "screensaver goes on, but allows a certain scope of commands to be run, such as manipulating a media player" (a sort of party mode, if you will)? – Ulrich Schwarz Mar 20 '12 at 15:46
  • Okay I see why there was a confusion. I updated it with a short example which should illustrate what my question is. So yes I'm looking for a sort of "party mode". – Azrael3000 Mar 20 '12 at 15:56
8

Maybe there is easier solution for this, but my first guess was to use actkbd - keyboard (but not only) shortcut daemon that works outside of X server.

In config file you can bind any keys combination to any command. More details about running actkbd you can find in this answer.

Rhythmbox can be controlled over dbus interface, so if you bind that command to some key it change your track.

dbus-send --type=method_call  --print-reply --dest=org.mpris.MediaPlayer2.rhythmbox  /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next

To discover more dbus "commands" you can use d-feet.

  • That doesn't look too bad. Unfortunately I'm really busy today, but I'll let you know if it worked. – Azrael3000 Mar 20 '12 at 16:43
  • actkbd looks pretty neat. – Renan Mar 20 '12 at 17:27
  • Thank you very much for the detailed and correct answer. – Azrael3000 Mar 20 '12 at 21:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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