2

I want my Alt Gr key to act the same way as the Alt key. I've found a potential solution which is to open up terminal and run the following commands:

xmodmap -e "clear mod5"
xmodmap -e "keycode 108 = Alt_L"

This solution works but only temporarily. Whenever I restart the computer it reverts back or even if I'm using my laptop for a few hours the fix is undone.

I'm wondering if their is a permanent solution to this issue.

Just a little about me, I've only started using ubuntu in the last few months so I'm very inexperienced with it so I apologise in advance if I have follow up questions for any potential solutions.

Many thanks

1

1 Answer 1

4

To get this change permanently for every session, create a file called .xmodmap with the the current keymap table, using the following command (after you have run previously xmodmap -e "clear mod5" and xmodmap -e "keycode 108 = Alt_L"):

xmodmap -pke > ~/.xmodmap

Then, create a file called .xinitrc in your home directory (using touch ~/.xinitrc command), containing the following line/command (use gedit ~/.xinitrc command to open the file for editing):

xmodmap .xmodmap

Another solution is to run:

sh -c 'xmodmap -e "clear mod5"; xmodmap -e "keycode 108 = Alt_L"'

command to your startup applications and that'll run it when you log in. Search in Dash for "startup applications".

11
  • Thank you for the answer, just to confirm, where exactly do I save the file?
    – user207489
    Nov 10, 2013 at 17:50
  • @user207489 In your home directory: /home/your_username. Nov 10, 2013 at 17:52
  • 1
    Hi, tried this and it didn't seem to work. Here is exactly what I did so you can see where I'm going wrong. I opened the terminal and ran the two previous commands. I then ran xmodmap -pke > .xmodmap. I then went to home directory, right clicked and created new document, named it .xinitrc and copied xmodmap .xmodmap into the document and saved it. Restarted and unfortunately it hasn't carried through. Any thoughts? Many thanks for your continued help aswell
    – user207489
    Nov 10, 2013 at 17:58
  • @user207489 Now what is the output of cat ~/.xmodmap | grep Alt_L ? Nov 10, 2013 at 18:05
  • Output is keycode 64 = Alt_L Meta_L Alt_L Meta_L keycode 108 = Alt_L NoSymbol Alt_L keycode 204 = NoSymbol Alt_L NoSymbol Alt_L
    – user207489
    Nov 10, 2013 at 18:06

Not the answer you're looking for? Browse other questions tagged .