Tilde key on Mac Air with Ubuntu

The solution that worked for Timofey did not work for me for some reason. However, a solution which did work was to put the line

echo 0 > /sys/module/hid_apple/parameters/iso_layout

into /etc/rc.local.

This suggestion comes from here:

https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1245081

via

https://stdio.sangwhan.com/backtick-tilde-problem-macbook-air/


Okay, I solved the problem.

First off, xmodmaprc doesn't work in Ubuntu 14.04. The solution is to edit xkb (X KeyBoard extension) config files.

Find the file /usr/share/X11/xkb/symbols/pc, backup it, then open and comment out the line:

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

And on the next line, add the following:

key <LSGT> { [ grave, asciitilde, grave, asciitilde ] };

If you need to change configuration for another locale, check the folder /usr/share/X11/xkb/symbols/ and find the file corresponding to the locale you want to change.

To apply the changes, you have to remove all xkb cache files:

rm -rf /var/lib/xkb/*