I am running Ubuntu server 16.04. Not sure if this matters, but I am forwarding the screen to a browser using XPRA.
All works reasonably well except for a few pesky key combinations. I am using a GB keyboard where between the SHIFT and Z keys there is a key with
bar (pipe), let's call this the 'bar key'. At the top left of the keyboard there is a key with a
notsign, let's call this the 'grave key'.
These keys all work fine in the client OS as well as when using SSH to the server. However, the moment I use them in any of the forwarded applications, e.g. xterm, they display incorrect characters.
The 'bar key' displays '\' (correct) and '¬' (incorrect, this should be '|').
The 'grave key' displays the grave '`' (correct) and notsign '¬' (correct)
So I tried the usual
xmodmap combination to figure out the keycodes and map them.
When I run xev I get the following output for the 'bar key'
backslash (\): keycode 94 bar (|): keycode 49
and the following for the 'grave key'
grave (`): keycode 49 notsign (¬): keycode 49
Looks like there is a lot going on on keycode 49, it is mapped to multiple physical keys.
To check what position things map to, I executed the following
xmodmap -e "keycode 49 = 1 2 3 4 5 6"
when I enter the various keys I get
\ = is still \ because we didn't remap 94 | = 2 ` = 1 ¬ = 2 (also 2 ... brilliant)
So how can I remap this if 2 characters map to the same keycode / position combination? (I have a couple of other ones to remap, e.g the @ key outputs Q, but let's get the first one going first)
Not sure if it helps, but here is some additional diagnostic info
~$ setxkbmap -query rules: evdev mode: pc105 layout: gb ~$ localectl status System Locale: LANG=en_GB.UTF-8 LANGUAGE=en_GB:en VC Keymap: n/a X11 Layout: gb X11 Model: pc101
I have spent two days on this and am losing the will to live. I hope this makes sense.