You are not logged in.

#1 2020-10-16 07:56:27

jfly
Member
Registered: 2020-01-30
Posts: 2

xmodmap interacting strangely with Chromium 86

I use xmodmap to customize my keys. Since upgrading to Chromium 86, I've noticed that running xmodmap with chromium running causes keys to act... strangely. Some specific examples:

  • Holding down the alt key focuses the 3 dots at the top right ("Customize and control Chromium")

  • The enter doesn't do anything in many places: trying to search on the Google home page, trying to send a message in Hangouts, trying to insert a newline in this text editor I'm using right now.

To try to capture this behavior in a screenshot, I put together a simple webpage that prints keydown information:

<html>
    <body>
        <script>
            document.addEventListener("keydown", console.log);
        </script>
    </body>
</html>

For now, I'm working around this by downgrading to Chromium 85. Is anyone else seeing this issue? Should I try to file an issue with Chromium itself? Thanks in advance!

In the following screenshot, I pressed "jkj" 3 times: before running xmodmap, after running xmodmap, and finally after running setxkbmap (to undo the effects of the xmodmap invocation). You can see that after running xmodmap, the `key` attribute changes to an unprintable box:

repro

Just in case that image doesn't work or goes away, here's a text transcript of the above:

KeyboardEvent {isTrusted: true, key: "j", code: "KeyJ", location: 0, ctrlKey: false, …}
KeyboardEvent {isTrusted: true, key: "k", code: "KeyK", location: 0, ctrlKey: false, …}
KeyboardEvent {isTrusted: true, key: "j", code: "KeyJ", location: 0, ctrlKey: false, …}
> // Now I'm going to go run `xmodmap -e "keysym a = e E"`
undefined
KeyboardEvent {isTrusted: true, key: "", code: "KeyJ", location: 0, ctrlKey: false, …}
KeyboardEvent {isTrusted: true, key: "", code: "KeyK", location: 0, ctrlKey: false, …}
KeyboardEvent {isTrusted: true, key: "", code: "KeyJ", location: 0, ctrlKey: false, …}
> // Now I'm going to run `setxkbmap`
undefined
KeyboardEvent {isTrusted: true, key: "j", code: "KeyJ", location: 0, ctrlKey: false, …}
KeyboardEvent {isTrusted: true, key: "k", code: "KeyK", location: 0, ctrlKey: false, …}
KeyboardEvent {isTrusted: true, key: "j", code: "KeyJ", location: 0, ctrlKey: false, …}

Out of curiosity, I checked, and that unprintable key has unicode codepoint 0.

> temp1
KeyboardEvent {isTrusted: true, key: "", code: "KeyJ", location: 0, ctrlKey: false, …}
> temp1.key
""
> temp1.key.length
1
> temp1.key.codePointAt(0)
0

Offline

#2 2020-10-19 14:56:31

yubo56
Member
Registered: 2016-01-07
Posts: 4

Re: xmodmap interacting strangely with Chromium 86

I can reproduce this as well, I have a bunch of xmodmap mappings and about half of them broke with Chromium 86: I use mode_switch + letters for arrow keys, F6 escape, page up/down, and only arrow keys work now. I'm also downgrading.

It seems from https://askubuntu.com/questions/668853/ … ey-mapping, https://bugs.chromium.org/p/chromium/is … =394552#c7, and https://src.chromium.org/viewvc/chrome/ … ion=289272 that this was always the direction Chromium was planned to go, i.e. handling their own keyboard code conversions instead of respecting xmodmap/xkb, so I think downgrading is all we can do for the time being.

To be precise, the relevant parts of my xmodmap looks like:

! remove Caps Lock
clear Lock
! add Mode_switch, Escape is caps lock
keycode 9 = Caps_Lock NoSymbol Caps_Lock
keycode 66 = Mode_switch Mode_switch

keycode 38 = a A Home
keycode 40 = e E End
keycode 27 = p P Up
keycode 29 = f F Right
keycode 43 = d D Delete
keycode 44 = h H BackSpace
keycode 46 = n N Down
keycode 57 = b B Left

keycode 41 = u U Escape

! On chrome, F6 gets you out of/into address bar focus (moves to next focusable area)
keycode 55 = k K F6

! Page up/Page down
keycode 18 = 9 parenleft Prior
keycode 19 = 0 parenright Next

All 8 of the basic ones, home/end/delete/etc work, but none of the last 4 work anymore.

Offline

#3 2020-10-19 16:16:46

jfly
Member
Registered: 2020-01-30
Posts: 2

Re: xmodmap interacting strangely with Chromium 86

That's interesting, and a bummer to hear that Xmodmap might not be a good solution for Chromium in the future.

However, even if Chromium is going to be handling their own keyboard code conversions, I don't think I understand why I'd be seeing the behavior I described in my original post. I don't actually see Chromium ignoring xmodmap (it *does* react to the one keysym I set up in that demo), but rather Chromium seems to get into a state where very basic keys just don't do what they're supposed to anymore (enter doesn't work, etc...)

Offline

#4 2020-10-19 19:38:25

aldum
Member
Registered: 2012-03-14
Posts: 8

Re: xmodmap interacting strangely with Chromium 86

I ran into the same problem yesterday, by today it really got on my nerves, so I went around and searched for a solution.
I found this, and successfully utililized the "second method", modifying

/usr/share/X11/xkb/symbols/pc

(I only have the menu key remapped to super, chromium and all webengine-based browsers were picking it up as the original key in addition to the new one)

Offline

Board footer

Powered by FluxBB