Google Chrome ignores XmodMap key mapping

My laptop Down arrow key is stuck on, so I have used Xmodmap to remove the mapping of that key with the following command:

xmodmap .Xmodmap

The contents of my .Xmodmap file is just the single line:

keycode 116 =

All programs in Ubuntu (such as gnome-terminal, xterm, Firefox, gedit) respect this mapping.

However, Google Chrome ignores this mapping, resulting in the page continually scrolling down or the volume being decreased when a full screen video is playing.

Looked at:

  • https://code.google.com/p/chromium/issues/detail?id=394552
  • https://superuser.com/questions/876515/chromium-is-recognising-keys-that-ive-disabled-with-xmodmap

Both of which had no available solution.

The solution from https://github.com/dnschneid/crouton/wiki/Keyboard to disable the keyboard layout management with:

gsettings set org.gnome.settings-daemon.plugins.keyboard active false

is not suitable for me as I need to enter Japanese characters so I need the IME to be available to swap between English and Japanese.


In issue 394552, one of the user notes that if you set the keymap to be a key that Chromium understands (such as a letter key), it respects the keymap.

Hence, going from the recommendation here, I set the down arrow key to map to the F18 key (which as far I can see, would never be pressed :P). So the contents of my .Xmodmap file is now:

keycode 116 = F18 F18 F18

I have tested with this new keymap and Chrome now seems to be behaving itself, like the other programs.


This answer solved it for me:

setxkbmap -option lv3:rwin_switch

And then run xmodmap again and restart the application.


Here's how I solved the same issue, and I'm putting it here for anyone with this problem.

I got the answer from here.

From the command line:

    sudo su

Now you have to figure out the scancode of the stuck key.

    showkey -s

Then press the key and it will give two scancodes: press and release. Write those down. Or, since your key is stuck, look for whichever code is repeating itself. For me, the down key comes in two scancode pairs: 0xe0 0x50 (press) and 0xe0 0xd0 (release). You have to abbreviate the scancode pair and use setkeycodes to remap it to a new keycode:

    setkeycodes e050 255
    setkeycodes e0d0 255

That will disable your down arrow key at the kernel level, which should prevent problems in Chrome. Apparently Chrome handles keyboard input somewhat independently of xmodmap and xkb. This was a deliberate change to accommodate how Chrome handles input in ChromeOS. Fortunately, disabling a stuck key at the kernel level stops the problem long before it reaches Chrome. This worked for me to stop a stuck numberpad 9 key from wreaking havoc.