GNOME Bugzilla – Bug 145272
Keyboard shortcuts do not reflect changes in keymap
Last modified: 2013-04-18 10:29:48 UTC
If the key mappings are changed while gnome-settings-daemon is running the daemon still uses the old keycodes for the keyboard shortcuts. To reproduce: - Open the Keyboard Shortcuts control panel - Defined a shortcut that uses the key XF86Mail (for example) - Use xmodmap to map XF86Mail to another key and map some other symbol to the key that used to be XF86Mail - Press the key that is now the new XF86Mail key: nothing happens - Press the key that used to be the XF86Mail key: the shortcut action is executed What should happen: - The shortcut action should only be executed when the key to which XF86Mail is currently being mapped is pressed
"- Defined a shortcut that uses the key XF86Mail (for example)" How do you know it uses XF86Mail? Because it actually doesn't and uses the keycode directly.
That's exactly the bug. > xmodmap -pke | grep Mail keycode 236 = XF86Mail > xmodmap -e "keycode 236 = " > xmodmap -e "keycode 146 = XF86Mail" > xmodmap -pke | grep Mail keycode 146 = XF86Mail After this pressing the old mail key still launches the action it used to and pressing the new mail key does nothing.
I guess this is irrelevant for most people anyway though. I guess it's not common to change mappings (and not log out/login after that).
"After this pressing the old mail key still launches the action it used to and pressing the new mail key does nothing." Your setup just so happens to use the key that's bound to XF86Mail for the "Mail" action.
Yes, it uses the keycode that was bound to XF86Mail when the daemon was run. But if I map XF86Mail to another keycode while the daemon is running the old keycode is still used. This can happen, for example, when switching from a keyboard model to another and changing the mappings to reflect the other keyboard. Maybe I'm missing your point.
My point is whether or not this key was bound to XF86Mail is irrelevant to the gnome-settings-daemon.
Yes, I understand that internally the daemon is only interested in keycodes. It doesn't, however, notice when the mappings are changed. The Keyboard Shortcuts preferences dialog uses names such as XF86Mail so as a user I would expect that if some action is specified to XF86Mail the XF86Mail key always runs that action, no matter which keycode it happens to be when the XF86Mail key is pressed. Anyway, this is not very serious since practically it only affects the situations in which the user changes the keymap for some reason - usually due to switching to another keyboard. The user can then log off and log on again. However, in this case the user may encounter bug 145271, which is far more serious. This bug can be left as it is (at least if there's no easy to way to inform the daemon about changes in mappings).
Ha, if the dialogue shows the name, then it should use that, not the keycode.
*** Bug 420186 has been marked as a duplicate of this bug. ***
Xorg 1.5 and above now supports input device hotplug. After a new keyboard device is hotplugged in, when X server receives first keystroke from a new keyboard device, it automatically switches the keymap to that of new keyboard device. The new keyboard may have new keysym definitions that are different from what GNOME grabbed during startup. GNOME must respond to keymap changes accordingly. Technically I don't think it is too difficult to implement. GNOME needs to grab MappingNotify events from X, and when a MappingNotify occurs, simply do another keysym to keycode conversion and do another round of grabbing.
*** Bug 604423 has been marked as a duplicate of this bug. ***
Mass move to new component "Keyboard" where the keyboard shortcuts live in GNOME 3.
That's been fixed by using gnome-shell for keyboard shortcut capture in GNOME 3.8.