1

I am using the Mac Canadian Multilingual keyboard with Ubuntu 16, shown below. The Canadian Multilingual text entry option works almost fine, but I have the following problems.

  1. The left alt and right alt are swapped. I have to press on the right alt key in order to write the brackets { and } (that makes coding and writing in Latex very difficult).

  2. The keys for ù and / are also swapped.

How can I fix this? I tried everything suggested in the related posts on this site (and elsewhere), to no avail.

I tried using an English configuration for my keyboard, only switching to French when necessary, but this makes me waste too much time.

Note: This problem is very serious for French-Canadian Ubuntu users. I must keep my MacBook air next to my Ubuntu desktop to write emails and to write in Latex.

Attempted fixes:

  • Using xev, I found that the left alt is keycode 64, registered as Alt_L, right alt is keycode 108, registered as ISO_Level3_Shift. The command xmodmap -e "keycode 64 = ISO_Level3_Shift" makes the left alt key unresponsive whitout fixing the problem.

  • In the file '/usr/share/X11/xkb/symbols/ca', I swapped the content (what is in the brackets) between the two following lines:

    key <TLDE>  { [     slash,  backslash,           bar ]  };
    key <LSGT>  { [    ugrave,     Ugrave ]     };
    

    While in the file '/usr/share/X11/xkb/symbols/level3' I swapped all appearances of LALT and RALT.

enter image description here

chicks
  • 574
Olivier
  • 113
  • 7

2 Answers2

3

Editing files owned by the xkb-data package should be avoided, since the changes will be lost if/when the package is updated. And in this case there is a more straightforward way to achieve what you want.

So, the first thing I suggest is that you reset the changes you made by running this command:

sudo apt install --reinstall xkb-data

Then you can use XKB options. To change the behavior in the current session you can run this command:

setxkbmap -option "lv3:lalt_switch,lv3:ralt_alt,apple:badmap"

If that does what you want, you can make the changes persistent by opening the file /etc/default/keyboard for editing and change this line:

XKBOPTIONS=""

to

XKBOPTIONS="lv3:lalt_switch,lv3:ralt_alt,apple:badmap"
0

Bad approach (see the other answer)

To swap the left and right alts, access the file '/usr/share/X11/xkb/symbols/level3':

sudo gedit /usr/share/X11/xkb/symbols/level3

and swap the character strings <LALT> and <RALT> everywhere they appear.

To swap the keys corresponding to 'ù' and '/' (for the Canadian Multilingual layout), access the file '/usr/share/X11/xkb/symbols/ca':

sudo gedit /usr/share/X11/xkb/symbols/ca

and swap the contents (what is between the brackets '[' and ']') of the keys <TLDE> and <LSGT>

Olivier
  • 113
  • 7