Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

This is not a question about setting up media keys, as mine have all been recognised and have their correct keysyms assigned, and I can use rhythmbox with them and other applications.

I was thinking that there must be a way to use the special XF86Audio keys (such as play, stop, next, and previous track buttons) with decibel, as most media player applications 'grab' the keys when you start the application. Some need setting up manually, but there doesn't seem to be any guides for decibel-audio-player.

Is it possible to use the appropriate laptop media keys with this player?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

As long as your multimedia keys have been recognised and have their appropriate keysym assigned, the following explanation will work fine. If not, please see the Ubuntu wiki and my answer for this question.

Your 'XF86Audio' media keys (i.e. play, pause, next track, previous track buttons) usually do not work straightaway with decibel-audio-player, so you need to use the remote application, which is by default located at /usr/share/decibel-audio-player/src/remote.py. To find the valid options, just run it with python:

python /usr/share/decibel-audio-player/src/remote.py

Here is the full list of options available for the command-line application, remote.py:

Command  | Arguments        | Description
-------------------------------------------------------------------------
next     |                  | Jump to the next track
pause    |                  | Pause or continue playing the current track
pl-add   | file1 file2...   | Append the given files to the playlist
pl-clr   |                  | Clear the playlist
pl-set   | file1 file2...   | Set the playlist to the given files
play     |                  | Start playing the current track
prev     |                  | Jump to the previous track
shuffle  |                  | Shuffle the playlist
stop     |                  | Stop playback
volume   | value (0 -- 100) | Set the volume

So, from the command-line, the python command that pause/plays a track when decibel-audio-player is already running is:

python /usr/share/decibel-audio-player/src/remote.py pause

Other commands that can be assigned to media buttons (individually) are, for example:

python /usr/share/decibel-audio-player/src/remote.py stop
python /usr/share/decibel-audio-player/src/remote.py next
python /usr/share/decibel-audio-player/src/remote.py prev

Now all you need to do is to assign the appropriate python command to the XF86 keysym that represents, for example, your play/pause on your laptop. Do this by going to shortcut settings, adding a new keyboard shortcut, then placing in the box the appropriate line above and then pressing the appropriate media key.

enter image description here

Repeat this method for however many media keys you have by using a different command and different media key every time.

When you have finished, your keyboard shortcuts application will look something like this, although I am using Xfce, so the settings section will look different for other desktop environments:

enter image description here

I thought this information was worth sharing, as I haven't been able to find any similar tutorials elsewhere, so perhaps it will be useful for someone.

share|improve this answer

Your Answer

 
discard

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