Setting special keys as keyboard shortcuts

Solution 1:

Read about Keybindings

dconf-editor

dconf-editordconf-editor > org > gnome > desktop > wm > keybindings

Key bindings are now stored in the dconf registry.

You can install dconf-editor to be able to view and edit them:

sudo add-apt-repository universe
sudo apt-get update
sudo apt-get install dconf-tools

or if you have universe repositories already installed get the package from UbuntuUpdates.org PPA's:

dconf-tools trusty package Install dconf-tools


You can also use gsettings command line tool.
For example, 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']"

org.gnome.desktop.wm.keybindings

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.

Multiple Keybindings

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']

org.gnome.settings-daemon.plugins.media-keys

Shortcuts from the Launchers, Screenshots, Sound and media, System, and Custom shortcuts are stored here.

Custom Shortcuts

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

org.gnome.settings-daemon.plugins.power

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.


xbindkeys

Also read about Text Entry Shortcuts with xbindkeys

xmodmap

And Mapping Windows Key with xmodmap

Best wishes,

Solution 2:

What I found so far, is that based on the answer from @swift and some evtest the way it is saved in dconf is not recognized by the system when you do it using the shortcuts from the settings, where it is saved like "Launch5, Launch6, Launch7, etc"

So you have to go to the gconf-editor and use the "code" of the key so you will have something like "XF86Launch5, XF86Launch6, XF86Launch7, etc"

The code I was able to get it with the instructions from xbindkeys and xbindkeys -k

edit: I wasn't able to add some images due the lack of reputation