Using a Mac keyboard on Windows

26. May 2011 11:37

I love the Apple keyboard. To me, the low profile with very low physical resistance to the key presses makes it the ideal developer keyboard. People ask me on a regular basis what I had to do to make it work on my Windows 7 computer, so let me summarize it in 3 levels.

 

Basic – getting it to work

Plug it in, it works. It has a standard USB connector (even though the included extension cord does not).

 

Intermediate – mapping Windows & Alt keys

I am a touch typist and I actually use the Windows keys (and Alt) on my keyboard all the time. Unfortunately, the Mac keyboard swaps the Alt and Command around. To re-map the keys, you can hack the registry or get someone to make a tool for that. Luckily, someone did: enter SharpKeys. Use SharpKeys to change the keys (see the screenshot below).

 

Advanced – quickly switch between keyboard layouts

There is (at least) one problem with using SharpKeys: if you use it on your laptop, the actual keys on your laptop get swapped as well, to the point that you have to press Ctrl+Win+Delete instead of Ctrl+Alt+Delete. If you use your laptop without keyboard attached some of the time, you can use this AutoHotkey script. Features:

  • Remaps Win and Alt keys
  • At startup, the script is disabled. You can enable/disable the script using Ctrl+Shift+CapsLock.

Note that this script is not flawless: sometimes, when using the Windows keys for other shortcuts (like Win+D to show desktop) the active window is sometimes “forgotten”, leaving you in another window than you might expect. It mostly works fine, though.

 

#SingleInstance force

AutoSuspend()

; context sensitive switches: not for remote desktop
#IfWinNotActive ahk_class TscShellContainerClass

LWin::LAlt
LAlt::LWin
RAlt::AppsKey
RWin::RAlt

#IfWinNotActive

+^CapsLock::
    Suspend Permit
   Suspend Toggle
Return

AutoSuspend()
{
    Suspend On
}
Comments are closed