I've been wondering how can I assign to multiple keyboard shortcuts to do the same action? More specifically, I want to be able to change my volume with both my headset buttons and my keyboard.

I'm able to change the volume with just one at the time: with the one I define in the 'Keyboard shortcuts' application. Is there any way?


I do just that with Custom Shortcuts:

screenshot of keyboard shortcuts settings

I use xdotool key --clearmodifiers XF86AudioLowerVolume (and XF86AudioRaiseVolume) command instead of amixer set 'Master' 10%+. The only difference/downside I notice is that even Repeat Keys on Typing tab is set this doesn't apply to this custom shortcut.

However, I wasn't able to do same things like use Fn+F7 to turn off my screen (xset dpms force standby). It doesn't detect it as a shortcut event.


You could probably use xmodmap to reassign the buttons on your headset to the same as you use for your keyboard.

  • Yes, but now I need to know what is the default action of 'Audio raise/lower volume', from the Keyboard shortcuts application. Because, when I use my own command 'amixer channel set opt', it raises/lowers the MBO sound card, while I'm listening with my headset. – ksemeks Aug 30 '11 at 7:50
  • @ksemeks : the actions are : amixer set Master 10%+ to raise the volume amixer set Master 10%- to decrease the volume. To get the gauge notification, you could use notify-send, but I am not sure how to set the gauge – danjjl Aug 30 '11 at 9:05
  • @danjjl: well, that's why I'm trying to find the exact action of the Volume up/down, from Setting->Keyboard->Shortcuts – ksemeks Aug 30 '11 at 9:10

You can assign multiple keyboard shortcuts (keybindings) for the same command using gsettings command line.

One important thing to know is that Ubuntu 18.04 Settings GUI only shows the first keybinding for a command, so if you have multiple keybindings for a command, the others won't appear in Settings. You can use gsettings to all the keybindings.

Let's say I want to add another keybinding for "Switch to Workspace 1". The default for me was Super+Home, but I want to add a second keybinding Ctrl+1.

# list all keybindings
gsettings list-recursively | grep -e org.gnome.desktop.wm.keybindings -e org.gnome.settings-daemon.plugins.media-keys -e org.gnome.settings-daemon.plugins.power | sort 

# confirm no other keybinding conflicts
gsettings list-recursively | grep '<Control>1'

# set multiple keybindings for "Switch to Workspace 1"
gsettings set org.gnome.desktop.wm.keybindings switch-to-workspace-1 "['<Super>Home', '<Control>1']"

# confirm value is set correctly
gsettings get org.gnome.desktop.wm.keybindings switch-to-workspace-1

Now you can use either Super+Home or Control+1 to Switch to Workspace 1. Remember, you will only see the first one Super+Home in the Settings GUI, but it will work!

  • This only works with the window manager hotkeys, not media keys which is what the user was looking for. Unfortunately media-keys only accept strings, not arrays. – hackel Dec 17 '18 at 21:38

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.