Key bindings are actions assigned to keyboard keys or key combinations. Ubuntu comes with a default set of key bindings including '<Alt>-Tab' to switch between windows and 'Print Scrn' to take a screenshot.
Gnome Control Center
Key bindings can be customized using the Gnome Control Center. It can be found as "System Settings" in the menu or accessed on the command line using "gnome-control-center". The key bindings are in the "Keyboard" section under a "Shortcuts" tab.
To assign a key to an action, click on the right hand side of the window on the currently assigned button or "disabled". The text will change to "New accelerator". At this point you can press the keyboard button (or key combo) you wish to use to access this feature or you can press the backspace key to disable the keyboard shortcut. If the key you wish to use is currently assigned to some other action, a dialog will appear asking if you want to "Cancel", or "Reassign". These keyboard shortcuts take effect right away.
The "launchers" category of shortcuts handles quick buttons for launching applications. Applications such as "calculator", "email client", and "web browser" can be assigned here.
The "navigation" category of shortcuts handles quick buttons for managing multiple desktop screens. Shortcuts can be assigned for moving between virtual desktops and for moving windows between multiple desktops.
The "screenshots" category of shortcuts handles various styles of screenshot. There are options for taking screenshots of the desktop, a window, or an area.
Sound and Media
The "sound and media" category of shortcuts handles keyboard media buttons such as "volume up", "volume down", and "mute".
The "system" category of shortcuts handles shortcuts such as "log out" and "lock screen".
The "universal access" category of shortcuts handles accessibility related shortcuts such as "zoom in" and "high contrast on or off"
The "windows" category of shortcuts handles shortcuts for controlling application windows. Items such as "maximize", and "close" can be assigned keyboard shortcuts here.
Under "custom shortcuts" you can assign key bindings to launch any application. To create a custom shortcut, use the "+" (plus) that is near the bottom of the window. Each custom shortcut needs a name, and command, and a binding. For example, you could create a custom shortcut to open a text editor. The name would be "Text Editor", the command would be "gedit", and the binding could then be assigned to the key of your choice.
Key bindings are now stored in the dconf registry. You can install dconf-editor to be able to view and edit them. You can also use "gsettings" command line tool. For examlple to get key binding on the command line:
gsettings get org.gnome.desktop.wm.keybindings switch-windows
or to set a key binding on the command line:
gsettings set org.gnome.desktop.wm.keybindings switch-windows "['<Alt>Tab']"
Keybindings that are handled by the window manager are persisted in the org.gnome.desktop.wm.keybindings section of dconf. The "Navigation", and "Windows" categories of shortcuts are stored here. In the past, each window manager was responsible for storing its own shortcuts under its own schema. Now both the metacity and compiz window managers use this central, unified set of bindings. There are mapping files in /usr/share/gnome-control-center/keybindings/ that show how these key bindings are used by each window manager.
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 <Alt>F4 as well as an easier to hit Pause/Break button, change org.gnome.desktop.wm.keybindings close to ['Pause', '<Alt>F4'].
Shortcuts from the "launchers", "screenshots", "sound and media", "system", and "custom shortcuts" are stored here.
Custom shortcuts are stored in dconf using a "relocatable schema". The schema name is "org.gnome.settings-daemon.plugins.media-keys.custom-keybinding". Each custom key binding has three properties: name, command, and binding. Because of the relocatable schema, it is harder to use "gsettings" with custom shortcuts. Here is an example of getting the name of the first custom keybinding:
gsettings get org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0/ name
Four additional buttons are managed in "org.gnome.settings-daemon.plugins.power". They are "button-hibernate", "button-power", "button-sleep", and "button-suspend". Possible values are "suspend", "sleep", "hibernate", "interactive", and "nothing". These buttons are NOT currently managed by the gnome-control-center. If you want to reassign the sleep button on your keyboard, you MUST currently use dconf-editor to assign the button in this section to "nothing".
Importing and Exporting
There is currently no functionality built in to Ubuntu for importing or exporting global keybindings. Users have asked for such functionality and scripts for doing so have been provided: http://askubuntu.com/questions/115333/how-do-i-disable-the-sleep-button-on-my-keyboard