Skip to content

cnaj/win-keys

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Windows key mappings for Emacs

About

This windows registry entry maps the control keys in such a way that the (in Emacs) often-used Ctrl key comes to lie right next to the space bar and the Alt key right next to it, to the right and the left of the space bar. This way, there is symmetry in using those keys with the right and the left hand, and Ctrl can be pressed by curling your thumb. Additionally, CAPS is mapped to an additional Ctrl, making it very accessible by using the left pinky.

Because the original left Ctrl key is left in place, most Windows key combinations work like usual. If you’re switching between Windows and Mac, you can configure a similar mapping in macOS’s Keyboard Settings, having Cmd in the same location as Ctrl on Windows. In effect, this allows you to type the same physical keys for combinations like Ctrl-V and Cmd-V on both systems.

The App key now serves as a AltRight key, making key combinations for international characters accessible when using the US-International or German keyboard layout, for example. Finally, the right Ctrl key becomes the Win key. Be aware that some laptop keyboards might not have the right Ctrl key, preventing the use of the Win-L combination to lock your screen, for example.

Caveats

  • the changes only take effect after a reboot
  • all users of the computer are affected by these changes
  • Ctrl-Alt-Delete works differently because of the changed location of the Alt key (might upset IT staff)
  • Win combinations (e.g. Win-L to lock screen) now use the right Ctrl key
  • App key is disabled
  • CAPS is disabled
  • AltRight (e.g. for US-Intl key combinations), or AltGr in ISO layouts, is now the key labeled App

Registry Entry

The key mappings are done on a low system level using the Windows scan code mapper, so no additional drivers are needed.

Registry Entry file

Download the .reg file (or copy the text below into an appropriate file) and run it (i.e. merge it with your local registry).

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,08,00,00,00,1d,00,3a,00,38,00,5b,e0,1d,00,38,00,1d,e0,38,e0,38,00,5c,e0,38,e0,5d,e0,5b,e0,1d,e0,00,00,00,00

Explanation

This MSDN article explains the configuration of the scan code mapper. The most accurate table of scan codes I could find can be seen here.

For reference, these are the mappings used in the registy entry, in the order they occur in the entry’s byte sequence:

PosfromScan codetoScan code
1.CAPS3a 00CtrlLeft1d 00
2.WinLeft5b e0AltLeft38 00
3.AltLeft38 00CtrlLeft1d 00
4.AltRight38 e0CtrlRight1d e0
5.WinRight5c e0AltLeft38 00
6.App5d e0AltRight38 e0
7.CtrlRight1d e0WinLeft5b e0

Remove keyboard mappings

Remove all scan code mappings with this entry:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=-

About

Windows key mapping for Emacs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published