Filed under: Switchers, Mac 101
Mac 101: change keyboard modifier keys with a Windows keyboard

You may recall that one of Apple's slogans when the Mac mini was released was BYOKM-bring your own keyboard and mouse. Well a lot of those keyboards will of course be Windows keyboards, and while they work fine on a Mac, there's one particularly annoying thing. For some reason the keyboard Windows key is mapped to the Mac Command key and the keyboard Alt key is mapped to the Mac Alt or option key. The reason this is a problem is that on a Windows keyboard the Alt key is right next to the spacebar (where the Command key is on a Mac keyboard). So if, like me, your keyboard shortcut muscle memory is to the key next to the spacebar then all your shortcuts get messed up on a Windows keyboard. Fortunately, there's a simple solution to this problem in the Keyboard tab of the Keyboard & Mouse Preference Pane. There if you click on the "Modifier Keys..." button you'll be taken to a dialog where you can easily remap the keys. So to make a Windows keyboard work like a Mac keyboard just change the option key to the command key and the command key to the option key as follows:

You'll also note that the Modifier Keys dialog lets you take care of another annoyance, the anachronistic Caps Lock key. Personally I find Caps Lock worse than useless as I sometimes inadvertently hit it. So you can turn it off altogether as I've done here, or you can set it to emulate one of the other keys (as Unix and Linux aficionados sometimes like to do).
So if you like to use a Windows keyboard with your Mac for whatever reason, these modifier keys settings will help keep you sane. Since my preferred keyboard is an old-school buckling-spring EnduraPro 104, these settings have been a great boon to me.

![TUAW [Cafepress]](http://www.blogsmithmedia.com/www.tuaw.com/media/tuaw-cafepress-promo.png)


Reader Comments (Page 1 of 2)
Alan said 3:15PM on 9-13-2007
Is it possible to have these settings automatically switch, depending on what keyboard is plugged in? At home, I prefer to use an external (Windows) keyboard, but on the road it's too much trouble to bring it along, so I use the built-in Macbook keyboard.
Reply
Dave Wood said 3:23PM on 9-13-2007
I was just about to ask that same question. I use a Windows keyboard at home and at the office on my MacBookPro, but need to manually switch the keys when on the road or using the MacBookPro on my lap!
I'm sure it could be done with some apple script, but I haven't found it yet.
Reply
Jon said 3:25PM on 9-13-2007
I have the exact problem as Alan. Please, someone point us in the right direction! It bugs me every time I have to switch between the work external USB kbd and the internal one to have to switch settings *again*.
Reply
Mat Lu said 3:26PM on 9-13-2007
@1 & 2: I'll post on this very question tomorrow. Stay tuned!
Reply
adisor19 said 3:37PM on 9-13-2007
The per keyboard settings are available in Leopard only ;)
Either insall a leaked build or wait till October :)
Adi
Reply
maxxel said 3:49PM on 9-13-2007
while we're on the subject (keyboard),
how to change Command+` (backward Command+Tab) to Command+§ ?
i wish to change it because on US keyboard, tab and ` are one above another and on international one, they are far apart, because ` key is next to left shift.
Reply
Galley said 3:55PM on 9-13-2007
I personally wouldn't go through all that hassle; I'd buy a $30 Apple keyboard. I guess if you were dual-booting it would be a different story.
Reply
maxxel said 3:57PM on 9-13-2007
ad #6
using Ukelele to alter keyboard definition doesn't help.
Reply
G-WiZ said 4:23PM on 9-13-2007
I do this all the time with my Microsoft Natural Elite keyboard at work. I bring in my MacBook Pro and have to adjust the settings EVERY time, then at the end of the day I switch back. I can at least use Quicksilver to bring up the keyboard pref panel quickly but there's no way to hotkey the keyswap using QS which you can do for network locations.
Reply
djdead said 4:51PM on 9-13-2007
Try controllermate (http://www.orderedbytes.com/controllermate/). I use it to change the modifier keys on a logitech G15 while simultaneously leaving the modifier keys as they are for the macbook keyboard. =)
Reply
Steve said 4:58PM on 9-13-2007
Does this button only appear when a non-mac keyboard is plugged in? On my Mac Pro (10.4.10) with a Mac keyboard & Mighty Mouse I do not have a "modifier keys" button at all.
Reply
Paul said 5:09PM on 9-13-2007
Here is a somewhat lengthy way to automatically switch the keyboard. The method uses a program called MarcoPolo as well as applescripts...
Link: http://fall-line.com/2007/07/02/change-keyboard-modifier-keys-automatically-on-osx-with-applescript
Reply
Nevan said 6:23PM on 9-13-2007
I use Doublecommand to do this. It's a little easier than the Keyboard pref pane, but still a pain to do every time.
http://doublecommand.sourceforge.net/
The developer promises:
"The highest priority now is having settings per keyboard, or at least only applying DoubleCommand to a single keyboard."
Reply
Jake said 12:23PM on 12-08-2007
You don't have to set DoubleCommand every time if you use the 'system' preference inside of the DC control panel; of course I have the opposite problem than described above. I like to use the CTRL key as my Command key but for some reason when I set that up, I lose my ALT key altogether, and can no longer select my operating system upon startup with Boot Camp. Very annoying.
Nevan said 10:54PM on 12-09-2007
@Jake: My problem is that I use a PC keyboard with a laptop, so I keep changing my settings. At home, I use the PC keyboard, but outside I use the laptop keyboard. Doublecommand has promised that they'll make it so that any keyboard is detected, but it hasn't happened yet.
BTW, I always use the 'user' setting, so I don't have to type in my password. What I've been looking for is a script I can run to automatically set Doublecommand to setting "80" (swapped alt and command) if it's set to '0' and vice versa.
David Fischer said 7:32PM on 9-13-2007
Or use Microsoft's Keyboard drivers for MS USB or Wireless keyboards. It enables modifier key swapping without affecting a laptop's built in keyboard setup.
As for Apple keyboards...I'll buy one when they've got a curved or ergo keyboard.
Reply
Ron said 9:51PM on 9-13-2007
I use the Microsoft Intellitype drivers (they work with any external keyboard), which allow you to specify key layouts for your external keyboard separately from the MacBook keyboard.
It also allows you to do some additional functionality which can't be done with the standard Apple preferences pane, such as assigning keys to change the volume, pause and start iTunes, etc.
Reply
Robert Brodrecht said 11:22AM on 9-14-2007
@Paul
I recently grabbed that script and modified it. The problem I had with it was that the author changed all the modifier keys back to defaults. I personally am sick of the caps lock key. So, I disable it. When the script resets to default, it turns the caps lock key back on.
In addition to changing the delay to .1 to speed the script up, I replaced:
else
-- We're in PC keyboard mode. Swap back to the defaults
click button "Restore Defaults"
end if
with:
-- We're in PC keyboard mode. Swap back to the defaults
click pop up button 3
click menu item 3 of menu 1 of pop up button 3
delay 0.1
click pop up button 4
click menu item 4 of menu 1 of pop up button 4
delay 0.1
I run this script when I login. When I'm at work, I've already plugged in my eternal keyboad, mouse, and monitor. Nothing fancy, but it works.
The only bug I've found is that if you have been playing with the system prefs and don't have the "Keyboard & Mouse" tab open when you quit, the script errors out. For whatever reason, it doesn't swap to the correct tab before continuing, or AppleScript doesn't do the "tell" correctly. I'm not sure, since I don't know AppleScript well. So, make sure you click back to the correct tab before closing system prefs.
I also popped off my alt key and windows key and swapped them to make it a little more Mac-like.
Reply
ZuDfunck said 10:39AM on 10-08-2007
I sure want to thank you for that
I bought a bluetooth Apple keyboard and I have been hitting that key constantly and this tip will save my sanity!
Thanx ZuD
Reply
John Carroll said 6:40PM on 10-08-2007
THANK YOU VERY MUCH ~ i clicked the 'no action' and feel better already!
thanks alot!
JohnC :]
Reply