11

This question already has an answer here:

Is it possible to assign multiple keyboard shortcuts for same default command. I want to switch between workspaces using CTRL+NUMPAD_1 and using CTRL+1 too.

Or how to add custom command for switching?

marked as duplicate by karel, Eric Carvalho, Fabby, Zanna, David Foerster May 4 '18 at 7:39

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Use "Custom shortcuts" under "Keyboard shortcuts" – Hatshepsut May 10 '18 at 19:10
  • Yes, you can assign multiple keyboard shortcuts for the command in Ubuntu 18.04. askubuntu.com/questions/59250/… (I couldn't post an answer here since this question was closed as duplicate). – wisbucky Dec 4 '18 at 21:38
4

Stephan's Answer which is quoted in Lambart's answer was updated and now has a very interesting side-note:

I also found out that the GUI that allows you to assign keybindings is limited in a way that annoys me. The GUI allows exactly ONE keybinding to be assigned to each action. In dconf, you can set an array of bindings for a single action.

Quick research lead me to Ubuntu's Wiki:

The keybindings that are handled by the window manager support multiple keys that will perform the same action. The gnome-control-center GUI does not support it, but you can make it work using dconf-editor. For example to have "Close window" use both the traditional F4 as well as an easier to hit Pause/Break button, change org.gnome.desktop.wm.keybindings close to ['Pause', 'F4'].

Anyway my attempt to set volume control to CTRL+SUPER++ and my laptop's media key via

gsettings set org.gnome.settings-daemon.plugins.media-keys volume-up ['<Primary><Super>KP_Add', 'XF86AudioRaiseVolume']

results in an error for invalid value while wrapping the array in quotes does not trigger an error but assigns no function to any of the keys neither. (I assume Ubuntu 12.04 might not having received an update in this regard).

  • 2
    Ubuntu 16.04: doesn't seem to work, I can set multiple values like this but only the first one has an effect – user1182474 Nov 27 '16 at 15:20
  • 1
    Ubuntu MATE 16.04, same story - no error, no work. Go figure. – CodeMouse92 Jun 26 '17 at 20:12
  • Works on Arch Linux. Similar Q/A with a screenshot for the dconf GUI here: unix.stackexchange.com/questions/361551/… – SimonG May 31 '18 at 19:56
3

I spent a while looking into this, and unfortunately the answer seems to be "no".

Stephen Ostermiller did some excellent research into keyboard shortcuts, which you can read in his answer, here: Where are GNOME keyboard shortcuts stored?

That led me to the dconf-editor utility, where I found the relevant settings:

dconf-editor screenshot

As you can see, my preferred shortcuts for switching workspaces are Alt1, etc. The square brackets around the Value led me to think that it might allow an array of values, but I although I was able to change the shortcuts via this value, was unable to get more than one to work. It would only use the first which one I defined.

But for anyone who finds this answer while trying to figure out how to set shortcuts for switching workspaces, I should point out that the easiest way to do it is via the GUI. In Unity, bring up the System Settings editor and navigate to Hardware > Keyboard > Shortcuts > Navigation. You'll find instructions at the bottom of the window:

enter image description here

  • Yes, you can assign multiple keyboard shortcuts for the same command, even though the Settings GUI doesn't let you. Tested on Ubuntu 18.04. askubuntu.com/questions/59250/… – wisbucky Dec 4 '18 at 21:39

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