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?
  • Could I ask why you want that? all shortcut with ALT key will not work, because there will be no Alt key if both configured as AltGr. – user.dz Apr 12 '14 at 7:30
  • 1
    @user.dz One would of course want that in order to continue using Left Alt as a modifier for writing symbols like @, |, «. or ». I don't want to have to relearn to use the Right Alt key for that. – slhck Jun 5 '18 at 19:56
  • try this answer here("askubuntu.com/questions/24916/…) – obake Jun 11 '18 at 13:12
  • this depends on your keyboard layout. I experienced this problem because I was using Italian/European Keyboard Layout. If you switch to US layout, alt gr is replaced with alt key – Fabrizio Bertoglio Feb 25 at 7:03

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 "[]"


  • 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.
| improve this answer | |
  • 1
    When I do that, the Right Alt key works the same as the Left Alt one (i.e., I cannot Alt-Tab anymore, or keyboard shortcuts that require Alt do not work). – slhck Jun 6 '18 at 14:31
  • @slhck Yes, by default making a key as layout level switch will disable it from modifier setup. Otherwise, you get a weird actions, lalt+a will activate menu and insert a with accent. :/. AFAIK xkb does not support multiple actions for short and long press. – user.dz Jun 6 '18 at 15:12
  • @slhck the original answer is exactly asking for that: "My questions are how can I get the current mapping of the right Alt key and assign it to the left Alt key?" If you have a different question, please a new question. – danzel Jun 11 '18 at 22:33
  • 1
    @danzel I understand there is a slight difference between simply mapping Right Alt to Left Alt, but you still need the functionality of Left Alt available somewhere in order to properly use the OS. With the given constraints I guess that this answer is the best one. – slhck Jun 12 '18 at 7:17

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

| improve this answer | |
  • 1
    This is nice but it doesn't solve my issue. – konze Apr 12 '14 at 11:13
  • Sorry to hear that. Perhaps a look at this link will be more helpful. – hmayag Apr 12 '14 at 20:54
  • I came back to this (unfortunately unsolved) issue, now I placed a bounty on the question. Unfortunately the options you showed do not include a control for swapping Left and Right Alt. – slhck Jun 5 '18 at 19:59

Right Alt is often used as the Compose Key so it may have been mapped to that function. You might solve your problem by looking closely in your system settings, under Hardware > Keyboard (not Personal > Keyboard Layout). Under the shortcuts tab, check and see if Right Alt is used as a shortcut to anything. Here's an example of what that menu looks like on my system, where I've mapped it as the Compose Key.

enter image description here

| improve this answer | |
  • Did that solve your issue, @slhck ? – JR. Jun 11 '18 at 21:21
  • Unfortunately not. I have Caps Lock set as my compose key. I do not even know how to get to this window that you're showing. – slhck Jun 12 '18 at 7:18
  • Perhaps it's a little different in 12.04 than it is on my 14.04 machine. It's the option in the upper right of the first image on this page: techdrivein.com/2012/03/ubuntu-1204-features-new-easily.html – JR. Jun 12 '18 at 18:41
  • I am using 18.04 now so that's why, I guess! – slhck Jun 13 '18 at 6:16

I used the process described in this answer, but instead of "Alt/Win key behavior", I found "Keys Level 3" and checked "Every key alt"

enter image description here

(My Linux is in French, sorry for my poor translation)

| improve this answer | |

Ubuntu 18:04

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

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.