How to fix the broken Tilde and Back-Tic keys in VMware Fusion


I installed VMware Fusion Pro recently and tried to use the Tilde key in debian, ubuntu, kali and windows Virtual machines without success. When I would try to type the ` or ~ keys I would get < and >, which was infuriating when working at a linux command prompt.

In digging around I eventually found a way to resolve the issue, I just wish it was easier.

References:

 

The Problem

Working in a terminal I sometimes have cause to use the Tilde and bactic characters. Running a linux VM in VMware Fusion neither of those keys are available.

In googling for 'change keyboard layout debian' and 'remap keys linux' I found a lot of information for how to use xmodmap. Unfortunately, it looks like recent versions of debian and ubuntu no longer use xmodmap. Instead they use something called xkb.

I have not found a comprehensive guide to how to modify keymaps in xkb style, so I spent a lot of time stumbling from blog post to blog post to forum thread desperately seeking information on how this system works.

 

The solution

In my case it looks like the tilde key is mapped as an 'extra' key that is found on some Eurpoean keyboards. In order to change the mapping so it functions as a tilde key I followed the advice found in this askubuntu thread:

  • cd /usr/share/X11/xkb/symbols
  • cp pc /home/username/pc.bak
  • nano pc
  • Change this line:

    key < LSGT> {    [ less, greater, bar, brokenbar ] };

    --to--

    key < LSGT> { [ grave, asciitilde, grave, asciitilde ] };
    (concrete 5 doesn't know how to deal with symbols that look like html tags, so I apologize for the formatting mess)

  • rm -rf /var/lib/xkb/*.xkm


What the above does is backup the global keymap file, remap the 'extra' key to back tic / tilde and delete any cache files that might get in the way of your changes being saved

 

Here's what my /usr/share/X11/xkb/symbols/pc file looks like after modifications:

Tilde Fix.png

 

Thoughts

In addition to xmodmap, there are many solutions out there which talk about reconfiguring the keymap using distribution command line tools. None of those worked for me which is why I went down the key remap path.