13

Binding keyboard shortcuts in Keyboard > Shortcuts > Launchers, to "special keyboard keys" like the Home, Search, Mail buttons etc., does not work on a new desktop (14.04.1), but did work on the former (14.04).

I can get those special keys of my keyboard (Microsoft Natural Ergonomic 7000) correctly identified when clicking them inside that settings screen, indicating the keys are recognized. However they do not in practice produce the "Launch" effect I have assigned to them there in that settings screen.

Rather, the mouse pointer just disappears when they are clicked (and shows again when the mouse is moved).

Oddly enough, they do get captured e.g. in Chrome, with their default Chrome behavior, but not by the desktop as expected by my settings.

Fiddling ls -l /dev/input/by-id and then sudo evtest /dev/input/.. I can notice these keys go through an event sink that is shared with mouse events, unlike those of ordinary keys on my keyboard.

I'm unsure:

  1. Why does this affect the desktop launchers, but not Chrome.. is Chrome just written better?
  2. Can I somehow avoid this?

Any ideas?

matanox
  • 2,293
  • I'm having a similar problem with a MS Natural 4000, while my web/home search keys work, the 5 Launcher keys no longer do. I had them setup as forward/back for music player and launching a terminal window. Similarly they where all setup via the Settings > Keyboard tool and are all correctly detected in keyboard settings. – Tim Jan 21 '15 at 02:23
  • Hrm, I am having the opposite issue in 14.04. They are recognized by system settings shortcuts but not in Chrome for the Google Play Music app. – Elijah Lynn Apr 20 '17 at 18:51

2 Answers2

18

Read about Keybindings

dconf-editor

dconf-editor dconf-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,

Pang
  • 373
swift
  • 3,281
  • 2
  • 23
  • 46
  • Thanks @swift. So in fact, before I try every and each of these things, do you have any direct explanation as to why it doesn't work as set up by me already through the UI? just want to understand the rational of diving so deep before going about tweaking. Much appreciated! – matanox Jan 19 '15 at 21:00
  • Sure. However some details about software you had used to set up your shortcuts for 14.04 and your trials of the same for 14.04.1 will be good. I think the better explanation merely about officials .. – swift Jan 19 '15 at 21:51
  • 1
    @swift, may be better if you use sudo add-apt-repository universe so no need to force specific mirror country or repository site. – user.dz Jan 22 '15 at 14:20
  • If I change org.gnome.desktop.wm.keybindings switch-input-source to Caps_Lock, it does change the layout on Cap Lock, but it also toggles all capitals. It's bizarre. – facetus Mar 09 '20 at 20:37
3

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