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

1

1

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

Posted 2012-04-22T00:01:45.410

Reputation: 113

Answers

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).

user 99572 is fine

Posted 2012-04-22T00:01:45.410

Reputation: 3 173

I get: "Error at line 2. Line Text: Alt. Error: This line does not contain a recognized action." – AnimatedRNG – 2012-04-22T15:24:02.157

darn, this shoulda worked. Sorry. I get the same error. Corrected the answer with new info. – user 99572 is fine – 2012-04-22T21:17:26.840

3

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"

Daimrod

Posted 2012-04-22T00:01:45.410

Reputation: 553