I set up US physical keyboards with a UK layout, because I can type without looking at the keys. But the key for backslash is missing. This is how I remap it to AltGr+Z.
Edit /usr/share/X11/xkb/symbols/gb
. In the extd
section, add this line:
key <AB01> { [ z, Z, backslash, bar ] };
Also, change dead_grave
to grave
near the top of this section to fix backticks. Save the file.
Delete the cached files in /var/lib/xkb
:
sudo rm /var/lib/xkb/server-*.xkm
Toggle layouts and possibly run setxkbmap
to get the changes.