Ubuntu – Left Alt key should work as right Alt key (Alt Gr)

keyboardxmodmap

I'm using a German Apple keyboard on my Ubuntu 12.04 machine. Under Mac OS X the left Alt key has the same behavior as the right Alt key (I think the right Alt key acts as the AltGr).
I don't know what I must remove from the mapping to clear the left Alt key and what I must add that the left Alt key acts the same way as the right Alt key?

My questions are:

  • How can I get the current mapping of the right Alt key?
  • And how can I assign it to the left Alt key?

Best Answer

Swapping Left ALT & Right ALT functions

  1. The following command will set:

    • Left ALT as level3-switch or ALT Gr
    • Right ALT as normal-alt or ALT

    _

    gsettings set org.gnome.desktop.input-sources xkb-options "['lv3:lalt_switch','lv3:ralt-alt']"

    Effective immediately.

  2. To reset it:

    gsettings reset org.gnome.desktop.input-sources xkb-options

    or gsettings set org.gnome.desktop.input-sources xkb-options "[]"

Notes:

  • To see all available options for all modifier keys make a look on /usr/share/X11/xkb/rules/xorg.lst
  • There are other hacks, I don't recommend. Like changing line include "level3(ralt_switch)" or swapping key codes in X11/xkb layout files.