Mapping the Left Alt key to Control and Alt Gr to just Alt

5,909

Solution 1

You can remap virtually any key to any other key using AutoHotkey. Check out the remap site: http://www.autohotkey.com/docs/misc/Remap.htm

The code should have worked:

LAlt::LCtrl
LControl & RAlt::Alt

For a complete List of keys look here: http://www.autohotkey.com/docs/KeyList.htm


EDIT:

since this solution does not work (for whatever reason), I suggest looking at this answer on StackOverflow: https://stackoverflow.com/questions/229633/how-to-globally-map-altgr-key-to-alt-key

This guy had the same problem and managed to remap Alt Gr to Alt in the registry (which is more reliable anyway).

Solution 2

On linux you can use xev and xmodmap.

Start xev from a terminal and look at its output to figure out what's the keycode of your to key.

KeyPress event, serial 36, synthetic NO, window 0x1400001,
    root 0x15a, subw 0x0, time 2274037, (436,185), root:(437,636),
    state 0x0, keycod*emphasized text*e 64 (keysym 0xffe9, Alt_L), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

Here the keycode of my Alt_L key is 64. Now use xmodmap to assign a new keysym to this keycode.

xmodmap -e "keycode 64 = Control_L"
Share:
5,909

Related videos on Youtube

AnimatedRNG
Author by

AnimatedRNG

I'm an Arch Linux user. Currently working on a lot of random projects, see my Github for details. Proficient in C, C++, Python, and Java. My New Years resolution is to learn Rust and Scala.

Updated on September 18, 2022

Comments

  • AnimatedRNG
    AnimatedRNG over 1 year

    On my laptop, I use Emacs. However, I don't have a left Ctrl key, and I considered mapping the left Alt key to left Ctrl and the right Alt key (Alt Gr) to just Alt (Meta). This way, I can just hit the keys with my thumbs. How would I do this?

    I'm using Windows right now, but I also might want to try this on Linux later.

  • AnimatedRNG
    AnimatedRNG about 12 years
    I get: "Error at line 2. Line Text: Alt. Error: This line does not contain a recognized action."
  • user 99572 is fine
    user 99572 is fine about 12 years
    darn, this shoulda worked. Sorry. I get the same error. Corrected the answer with new info.