Permanently swapping option and command keys on a non-Apple keyboard

Whenever I plug my Microsoft Natural Ergonomic Keyboard into my MacBook Pro, I have to swap the Command and Option modifier keys. How can I prevent these keys from reverting to their default settings whenever I unplug the keyboard?


Solution 1:

I assume you already know about the Keyboard Pref Pane. I had exactly the same problem with an Ergonomic and an Arc. The settings didn't stick with external keyboards.

Install KeyRemap4MacBook. It works for any Mac, btw. It remaps keys on all keyboards of a Mac - try to use Enter as Right-Cmd, e.g.

  1. Set Cmd to Alt etc. for all keyboards in KeyRemap4MacBook (both right and left).
  2. Switch the keys in the Keyboard Pref Pane for the internal keyboard. Et voilà!

I figured out that weird hack some time ago. It turned out to be rock solid. Only thing to remember: hardware based utilities such as SteerMouse use the 'real' keys, so you need to switch around some things.

Solution 2:

Thanks thyx & notme for suggesting KeyRemap4MacBook. Here are my enabled settings:

  • General
    • Don't remap an internal keyboard
    • Don't remap Apple's keyboards
  • Change Command_L Key (Left Command)
    • Command_L to Option_L
  • Change Command_R Key (Right Command)
    • Command_R to Option_R
  • Change Option_L Key (Left Option)
    • Option_L to Command_L
  • Change Option_R Key (Right Option)
    • Option_R to Command_R

Solution 3:

thyx is right. Grab KR4MB here: http://pqrs.org/macosx/keyremap4macbook/ - No need to worry about it not getting updated as the dev is super responsive and is constantly tinkering with the app making it better with every release. Another note is that it's open source so if you know your way around you can make changes yourself but I doubt you will need to. It's great software, I have been using it for years and on a wide variety of keyboards with no problems that could not be easily amended by reading the prepared docs. Give it a try, if you use Safari check out his extension "keystroke." I wouldn't be able to use safari without it.

Solution 4:

KeyRemap4MacBook is now Karabiner (currently 10.6.0); still available at the links above, and also https://pqrs.org/osx/karabiner/

Never used it before, so I can't speak to what changed with the name. It's consistent with the previous descriptions; I used the settings exactly as described in TitaniumDecoy's answer, then also mapped the Application key to Fn. Suddenly, my ancient KeyTronic LT Designer is much more OSX-friendly.

There are lots of options, so I can understand the frustration with configuring it. On the other hand, there are lots of options. Maps can depend on which application you're running, and there are a lot of preconfigured settings that take advantage of that feature.

The only thing I'd like to see added is to have different maps for different keyboards, automatically and simultaneously. You can disable mapping on Apple keyboards, and/or integral keyboards. But I can't swap CapsLock for Ctrl everywhere (yup, I <3 Emacs), while swapping Option and Command on only the PC-101 keyboard. However, you can create several profiles, and switch between them easily, so that's a 90% solution.

Joe Bob says "If you're suffering with a Windows keyboard, check it out."