This is not something I do often, so I had never encountered what I am about to describe until now. In a terminal on the guest, typing the ` key on my Mac gives <. And typing Shift-` (which is usually ~) gives >.
Oddly, this does not happen with a guest that is running directly on the Mac as the host.
The kluge, which I found at this UK-based blog for surgeons, is to remap the key using xmodmap. (I thought I was done with xmodmap about 10 years ago.) NB they have a typo: it should be “tilde” rather than “tilda”. Create the file ~/.xmodmaprc with the following line:
keycode 94 = grave asciitilda
$ xmodmap ~/.xmodmaprc
What I don’t quite understand is the value of the keycode, 94. On the guest, I do:
$ sudo showkey -s
and then type the key I want to see. It emits the code 0x56 on press, and 0xd6 on release. I thought that would be the keycode (after conversion to decimal), but it is not.
My guess is that it is an issue with X11. In XQuartz, I tried the 4 combinations of setting and unsetting these two:
- Follow system keyboard layout
- Enable key equivalents under X11
but they did not change the way the grave/tilde key worked, i.e. it still emitted </>.
I also tried setting the keyboard locale:
but that did nothing, either.
I also tried setting the keyboard locale:
$ localectl status System Locale: LANG=en_US.UTF-8 VC Keymap: us X11 Layout: us X11 Model: pc105+inet X11 Options: terminate: ctrl_alt_bksp$ localectl set-keymap us-mac$ localectl status System Locale: LANG=en_US.UTF-8 VC Keymap: us-mac X11 Layout: us X11 Model: pc105+inet X11 Options: terminate: ctrl_alt_bksp
but that did nothing, either.