How to globally map AltGr key to Alt key?
Solution 1
Thank you all for answers. I was unable to solve this using AutoHotkey -- PhilLho's answer was close, but I really needed exatly the same behaviour as with left Alt key.
However, the registry thing actually worked as I needed.
Save this as AltGR_to_LeftAlt.reg file and run it:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,02,00,00,00,38,00,38,e0,00,00,00,00
Or, there is a GUI tool that does this for you -- it's called SharpKeys and works peachy:
Oh, and don't forget to reboot or log off -- it won't work until then!
Solution 2
As pointed out by PhiLho, Windows provides a way to remap any key, through the registry key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout
. A basic overview can be found at Scan Code Mapper for Windows. A better description is probably Answers to Scancode Mapping or Changing Key Values.
I'm using this approach to put the Windows Key
on the Caps Lock
, because my keyboard doesn't have a Windows Key
and I don't need the Caps Lock
.
Solution 3
This worked for me:
LControl & *RAlt::Send {LAlt Down}
LControl & *RAlt Up::Send {LAlt Up}
And this for mapping it to the Windows key:
LControl & *RAlt::Send {LWin Down}
LControl & *RAlt Up::Send {LWin Up}
Registry modification using SharpKeys (see above) is more reliable though (if you have administrator access).
Solution 4
I got a decent behavior by combining two hotkeys:
LControl & RAlt::Send {Alt}
RAlt::Alt
The first one is for the standalone keypress (avoid to hold it down...), the second one to be used as combination (Alt+F, etc.).
It isn't perfect, you can't do a combination like Ctrl+Alt+T, but perhaps it is enough for your needs.
Note that you can do a permanent remapping using the registry. See this forum post for an example. Not sure that it applies to compound keys like this one, but I thought I should mention it...
Related videos on Youtube
Tomas Sedovic
“It’s better to aimlessly go forward than to aimlessly stand still – not to mention aimlessly going backwards.” -- Emiel Regis Rohellec Terzieff-Godefroy
Updated on December 09, 2021Comments
-
Tomas Sedovic over 2 years
I want my AltGr key to behave exactly like left Alt.
Usually, I do this kind of stuff with Autohotkey, but I'm open to different solutions.I tried this:
LControl & RAlt::Alt
And Autohotkey displayed error about
Alt
not being recognized action.
Then I tried the following code:LControl & RAlt:: Send {Alt down} KeyWait LCtrl KeyWait Ralt Send {Alt up} return
which sort of works - I'm able to use the AltGr key for accessing hotkeys, but it still behaves differently:
When I press and release the left Alt, the first menu item in the current program receives focus.
Pressing and releasing AltGr with this script does nothing.Any ideas? Is this even possible with Autohotkey? (remapping right Ctrl and Shift to their left siblings was piece of cake)
Note: I tried switchingAlt
toLAlt
in the code and it made no difference. -
Tomas Sedovic over 15 yearsSorry, but it does not work for me. The first examples returns the "not recognized action" error and the second one does nothing at all. Of course, it is possible that something is wrong with my setup. Did it work on your side?
-
Brian Schmitt over 15 yearsI don't have the key, but looking in the AHK documentation showed this that the <^>! is the symbol for AltGr. Right Click TrayIcon-->Help-->Hotkeys
-
sage over 13 yearsSince I'm not supposed to add software to my work machine, this is really useful. I used the Scan Code Mapper for Windows link to map Caps to Ctrl before stumbling across the ready-made reg file at "Is it worth swapping Ctrl and Caps...".
-
Piotr Dobrogost over 10 yearsWhy do you map combination of
LControl
andRAlt
instead ofRAlt
alone? -
Dave James Miller over 10 yearsWhen you press AltGr Windows actually signals that you pressed both right Alt and left Ctrl keys.
-
Nye over 9 yearsThis answer is wrong: SharpKeys does not support Alt Gr. (sharpkeys.codeplex.com/workitem/10375)
-
Andreas about 9 years
Right Alt
worked as a substitute forAltGr
for my purposes (remapping bootcampCmd
toAltGr
), with the one difference that I had to select it manually from the list. "The right Alt key is usually an equivalent of the AltGr key" - en.wikipedia.org/wiki/AltGr_key -
nover over 8 yearsThis answer is correct. I have successfully remapped my left and right ALT keys on my mac keyboard with SharpKeys. You need two mappings, one for
left<=>right
andright<=>left
swapping of ALT keys. -
Richard almost 2 yearsHow do you undo this please?