You are not logged in.
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:
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
Last edited by jfly (2020-10-29 21:23:37)
Offline
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
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
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
For the record, this problem seems to have gone away somewhere in between chromium-86.0.4240.75-1 (broken for me) and chromium-86.0.4240.111-2 (working for me).
I looked through `git log 86.0.4240.75..86.0.4240.111` on `git@github.com:chromium/chromium.git` and did some light searching through the commits. This is a possibly incorrect history:
- At some point Chromium stopped looking at something XKB related
- There was an initial attempt to fix this: https://chromium.googlesource.com/chrom … 19c82ca7df
- That fix was reverted because it broke compilation on a bunch of platforms: https://chromium.googlesource.com/chrom … 1ab7748544
- The fix was re-applied in a way that didn't break compilation: https://chromium.googlesource.com/chrom … 07202f7e9c
It sounds like this was meant as a quick hack to get things better on Chromium 86 and 87. This comment (https://bugs.chromium.org/p/chromium/is … 136206#c15) makes it sound like this is the right fix: https://chromium-review.googlesource.co … +/2464786/ ("Convert keycodes and keysyms using XKB when available"), and it will go out in Chromium 88.
Offline
Sorry for the necrobump, but I wanted to add an update here in case anyone lands here. Some version of this problem got reintroduced with later version of chromium, and I gave up and switched to using xcape, which didn't have problems with chromium.
I recently discovered interception-tools, and it also hooks into stuff at a low enough level that it has no trouble with chromium. I'd highly recommend it if you have the option of using it!
Offline