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

Solution 1:

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.

Solution 2:

First, select System Settings :

Screenshot 1: open System Settings

Select Keyboard Layout from the presented window :

Screenshot 2: select "Keyboard Layout"

You will be presented with a list of all available layouts. Just press the Options button:

Screenshot 3: click "Options"

Lastly, from the presented list select Alt/Win key behavior and modify to your needs:

Screenshot 4: "Alt/Win key behavior" list

Solution 3:

Ubuntu 18:04

gnome tweaks -> Keyboard & Mouse -> Additional Layout Options -> Key to choose the 3rd level -> Any Alt

enter image description here