Using an Apple keyboard on Windows

I love the Apple keyboard. To me, the low profile with very low physical resistance to the key presses makes it an ideal developer keyboard. It has a 2 port USB 2.0 hub hidden beneath the keyboard as well, which could be a bonus for people travelling with laptops with a limited number of USB ports.

Apple keyboard

Note that there is a big difference between the US layout and the layout for the rest of the world: the US version has a flat return key, whereas most (all?) other versions have the comma/seven shaped return key shown in the image above. This is a matter of preference, but I strongly prefer the US layout with the wider return key on the ASD-row.

Swapping the Alt and Windows (command) keys

On the Apple keyboard, to Alt and Windows key work out of the box, but they are reversed (Apple: control>alt>command, Windows: control>windows>alt). To change the order of these keys permanently, a registry fix is the easiest way to accomplish this. There are 2 simple ways of doing this: using a tool to edit the registry or manually changing the registry values.

Approach 1: SharpKeys

You can get the tool on sharpkeys.codeplex.com. In the tool, you remap the following keys:

  • Left Alt to Left Windows
  • Left Windows to Left Alt
  • Right Alt to Application (also known as Shift-F10)
  • Right WIndows to Right Alt

A screenshot from an older version of the tool showing the remapping:

Sharpkeys screenshot

Some caveats from the SharpKeys site: remappings are done at the machine level, in other words: they are not specific to any single user account but apply to the overall Windows system. Note that SharpKeys "simply" writes the keyboard remappings to the registry, leading to the second approach:

Approach 2: edit the registry

You can manually edit the registry, or import a new keyboard layout through a .reg file. Importing the file below will result in the keyboard changes listed:

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,05,00,00,00,5b,e0,38,00,38,00,5b,e0,\
  5d,e0,38,e0,38,e0,5c,e0,00,00,00,00

To undo the mapping, simply run the following .reg file:

	Windows Registry Editor Version 5.00

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

The changed keymaps will take effect after logging out and logging back in again (reboot not required).