Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to globally map AltGr key to Alt key?

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 switching Alt to LAlt in the code and it made no difference.
like image 406
Tomas Sedovic Avatar asked Oct 23 '08 13:10

Tomas Sedovic


People also ask

Can you use AltGr for Alt?

The key combination [Ctrl] + [Alt] offers the same function as Alt Gr. In this way you can make use of so-called “third characters.”

Is AltGr the same as Ctrl Alt?

The combination Ctrl+Alt is also known as AltGr, and it acts as an alternate shift key. For example, consider the German keyboard layout. Notice that there are three keyboard shift states (Normal, Shift, and AltGr), whereas on U.S. keyboards there are only two (Normal and Shift).

How do I set up AltGr?

Using it is rather straightforward. Just like how you use the Control key for Ctrl + C, you can use ALT GR + key which also houses the special or the accented letter. Windows allows emulating Alt GR when you press Ctrl + Alt keys together.


2 Answers

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:
SharpKeys in action

Oh, and don't forget to reboot or log off -- it won't work until then!

like image 126
Tomas Sedovic Avatar answered Sep 21 '22 11:09

Tomas Sedovic


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.

like image 40
Ronald Blaschke Avatar answered Sep 17 '22 11:09

Ronald Blaschke