I'm using Ubuntu desktop 18.04

When going to

settings -> Devices -> Keyboard

it's possible to change the keyboard shortcuts or add them.

My keyboard doesn't have a button for Audio next or Audio previous. So I want to set a shortcut myself. (I want to be able to do next/previous track in Spotify and ctrl+arrow only works with an active window)

However I don't want to overwrite the original in case I have to use another keyboard or this maybe causes issues with connected audio devices or whatever.

So I just want to add another shortcut which runs the same command.

How can I find the command associated with the audio controller?

I.e. moving an active window to the right monitor is:

 wmctrl -r ":ACTIVE:" -e 0,1920,0,1920,1080

So here wmctrl is a command used to control windows. But I would like to know the one which controls the audio.

I found this answer but I also cannot find how to go to the next track via ALSA or PulseAudio.

I don't want to install other applications for this as some sites suggest.

Since the shortcut keys can be changed on-the-fly I'm guessing the commands must be somewhere in a config file.

My main question is:

Where can I find the command (or file) associated with changing audio tracks.


As for just getting better in working with Linux and for others with similar but different questions. How would one search to resolve issues like this? This is more in the lines of how does Linux interact with hardware and applications. Like when I press something on the keyboard or mouse it sends a signal which goes to the keyboard driver which sends it to other processes which execute commands? Or is this to broad and do I just have to take some time and work through a Linux OS tutorial ? (which is never a bad idea just too much to do too little time)


A list of Hotkeys is provided from the Official Ubuntu Documentation. For reference, the default Desktop Environment of Ubuntu, 18.04 and newer, is GNOME, so these will also work on any current GNOME system.

| improve this answer | |

Well, I think I got it.

All the shortcuts associated with the commands you find at Keyboard settings are stored through dconf (for 18.04). Particularly the audio control ones in org.gnome.settings-daemon.plugins.media-keys.

This way you can use gsetting to associate a shortcut to the desired command:

gsettings set org.gnome.settings-daemon.plugins.media-keys play "'<Primary>Enter'"
gsettings set org.gnome.settings-daemon.plugins.media-keys previous "'<Primary>Left'"
gsettings set org.gnome.settings-daemon.plugins.media-keys next "'<Primary>Right'"
gsettings set org.gnome.settings-daemon.plugins.media-keys volume-up "'<Primary>Up'"
gsettings set org.gnome.settings-daemon.plugins.media-keys volume-down "'<Primary>Down'"
gsettings set org.gnome.settings-daemon.plugins.media-keys volume-mute "'<Primary><Shift>Down'"

And if you want multiple shortcuts to the same command, write on it a list, as in the follow example:

gsettings set org.gnome.settings-daemon.plugins.media-keys next "['<Primary>Right', 'XF86AudioNext']"

You can also use gsetting get (with the path and command you want) to find out what is it's actual value, and discover the defaults you want to keep active.

Here there is an answer that can help a lot in this context

| improve this answer | |
  • 1
    Hi, this looks like it's indeed what I'm looking for. However I tried adding buttons, but it's not working. I tried multiple combo's and even just ['Right', 'XF86AudioNext'] but it's not skipping to the next song when clicking the right arrow. Do you know how I can find which buttons have which command/string? – user3605780 Dec 16 '19 at 11:48
  • I just added a link in the answer that can help in your search! Try it and come back if you have any doubt – artu-hnrq Dec 17 '19 at 0:59

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.