Setting Custom Keyboard Bindings in GNOME on Arch

As of today’s writing (Nov 11th, 2015), the GNOME settings center on Arch has an issue with letting you set up custom keyboard shortcuts/bindings/etc.

When adding a custom shortcut in Settings>Keyboard>Shortcuts, you’re prompted to set a name for the shortcut (should be changed to a “description” field instead) as well as the full command to be run when activating that shortcut. The issue is when actually trying to set a key binding.

When attempting to set the binding as per the instructions:

A prompt to edit the name and command for the shortcut just pops up:

From the research I did, it seems that the only way to actually fix this issue would be to use the gsettings command to remedy the issue.

There are two paths one can take. First path will use the GUI to make the custom shortcut itself and then gsettings to create the binding. The second path will use the gsettings command to do the whole process.

Path 1:

1. Create your custom shortcut. Go to Settings>Keyboard>Shortcuts and press the + button. Fill in the name and command for the shortcut and click “Add”.

2. Open a terminal instance and type the following command:

gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/customZ/ binding 'xxxx'

Replace the Z with the index of the custom shortcut you’re modifying starting from 0 instead of 1. EG: First custom shortcut will have an index of 0 so replace customZ with custom0. Second will be custom1, etc.

The xxxx will be the keys required to be pressed in order to activate the shortcut. <Ctrl>, <Alt>, <Super>, and <Shift> being the strings needed to be entered for modifier keys. EG: Ctrl+Alt+t would translate to <Ctrl><Alt>t

Path 2:

1. Create your shortcut with gsettings by entering the following command:

gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings "['others', '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/customZ/']"

This time, you can use any number that hasn’t already been used to replace Z with.
2. Set the name, command and binding with the three following commands:
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/customZ/ binding 'xxxx'

gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/customZ/ command 'yyyy'

gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/customZ/ name 'zzzz'

Make sure that you use the same number for Z as in step 1 for this path. Otherwise you may get an error or set something for an incorrect shortcut. Replace xxxx with the key bindings, yyyy with the command you wish to have executed, and zzzz with the the description for the shortcut.

 

All of these commands take effect immediately and do not require anything to be restarted.

Note: Make sure you refer to the shortcuts already established so you’re not creating custom shortcuts that have already been made. You run the risk of activating two shortcuts at the same time, running nothing at all or even deleting the previous shortcut that had that same keybinding.

Leave a Reply

Your email address will not be published.


*


This site uses Akismet to reduce spam. Learn how your comment data is processed.