I would like to acheive the following behaviour:

If a music player (Banshee in my case) is running, the Play/Pause media key on the keyboard causes the music player to play/pause the music. If the music player is not running, the Play/Pause media key launches the player.

The first case works out of the box since that is the standard behaviour. The second case does not work because the key is bound to the play/pause action which has nothing to do with launching any application. Is it possible to get the second case working?

I'm looking for an elegant solution using standard system features. I can always write a script that will (more or less) do that and bind the script to the play/pause key, but that is not the type of solution I look for.

I'm running Ubuntu GNOME 14.10 with GNOME Shell 3.12.2.


Go to Keyboard -> Shortcuts. Under sound and media see to what button does play action is attached with: If it is audio play button, you will be able to play or pause when your application is running. If not make it so by clicking on that item and giving the audio play button as the New Accelerator. Now in the same window go to Custom Shortcuts and click on the + button and add command for opening your application and give a name(in my case command is audacious). Now click on this new item and add the New accelerator (I gave Shift+Play). Remember if you give play button itself here it will reassign the button play for launching your application and you will not be able to do the play/pause action using the same button.

| improve this answer | |

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.