Ady's OS 9 on Mac Mini site!

Remapping Modifier Keys on Mac OS 9

I wanted to remap my modifier keys in Mac OS 9, but I couldn't find much documentation about this online. I'll document here what I found and how I got it working.

I've seen (and got my solution partially from) swapping the Command and Option keys, as documented here. This is useful if you want to convert a Windows style keyboard to the Mac style layout—Command next to Space.

Instead, I wanted to swap Command and Control on my Windows style keyboard, as I like having Command mapped to the bottom left corner of my keyboard, for windows-like shortcuts as that's what I grew up learning, and I use linux daily with this configuration too.

Alright, down to business:

  1. So if you want to swap keys, you'll need to know the codes to swap. Below is an image from this dense but enlightening Apple developer document that will show what keys correspond to what codes. I wanted to swap Command and Control, which are 3b and 37. (Lower case used here to make it clear: Control is represented by 3b and not 38.) Note down anything you wanna swap.

Key Codes for swapping

  1. Next, you'll want the software SuperResEdit (I would bet ResEdit works too, but I used the former).

  2. Open your System Folder and copy the file inside there called System to your desktop or somewhere else safe. You can't edit the currently in-use version, so we gotta make a copy.

    Now duplicate that file, and call it Original System and DON'T touch that one in case you screw anything up; you're gonna be hex editing stuff AND messing with your keyboard layout, so you'll want an easy backup you can revert to, even if only your mouse works.

  3. Open System (the copy on your desktop that you wanna modify) in SuperResEdit. You'll get a big array of icons with 4-character identifiers, each of which contain lots of data and constants that make the OS work.

  4. Find the KMAP resource with a little keyboard icon, and open it up. You'll get a new window with a few resources, and you'll wanna open number 2 in a new window. It should look roughly like the image below.

KMAP resource in SuperResEdit

  1. If you're not familiar with SuperResEdit or hex editors, be cautious, and only change what you need to here.

    See how the bottom line of data, 000088, is exactly one full line just like all the ones above it? Make sure it also looks like that after you edit it; you don't wanna cut anything out or add extra data where it's not expected.

  2. Anyways, I wanna swap 3b and 37, and I've already done that in the screenshot above. Before the edit, the highlighted section said 3B37; I deleted that and typed in 373B instead.

    Note that in this hex editor, backspace will delete two characters at a time because of how the data is structured.

  3. Close out those two most recent windows until you get back to the one with the big list of icons where you first found KMAP. It's fine to close these windows, as this whole process is just editing one big file, the System file, and you'll save all your changes at the end.

  4. Find and open ROv#, then open the resource inside it to get a window like below.

ROv# resource in SuperResEdit

  1. Scroll all the way to the bottom and click the very last ***** to select it. Press Command-K to create a new entry below that. With your keyboard, enter KMAP as the TYPE and 2 as the RES ID. The above image shows the window after these changes have been made.

  2. Save the file.

  3. To test your changes, go back to your System Folder and drag the System file there to the trash. Now, drag the new edited System file from your desktop into the System Folder as the new active file.

  4. Reboot, and your changes should be active. If you messed something up, make another duplicate of Original System and start over at step 4, editing that until you figure it out. If it did work, congratulations! Enjoy using your system how you prefer.