I must have an odd keyboard, at least for one that’s paired with a Mac. It’s a Microsoft split keyboard and has a bunch of extra keys that aren’t on a Macbook Pro keyboard, like a dedicated # key and the keys are all over the place compared to the laptop keyboard. But I like it that way.
I’ve heard comments from people who use my laptop and they are confused by how shift-2 doesn’t print @ but ” instead, and the key by the left shift prints \ instead of ~ (which is over by the Return key). They’ll say, “Oh, it’s some sort of PC keyboard?” Well, yeah.
This is not the first time I’ve had to fix my keyboard. A long time ago Justin Mason created a useful Irish Fixed Keyboard Layout, but for some reason with this latest hardware upgrade it wasn’t working exactly as planned. The #, \ and ` keys were mixed up. Luckily, with the help of the Key Codes app I could detect the the key code of the physical key pressed. For example, the key next to the left shift is key code 10 so it was just a matter of editing the keyboard layout in a text editor and changing that to output “\”. Logout and login to refresh and the key works!
What’s odd, is that this keyboard layout has served me well for almost a decade and didn’t need editing, which is why I’m documenting it in this post.
I looked at both Ukelele and Karabiner but the former looked overwhelming (yeah, then I went editing XML by hand..) and the latter doesn’t work in macOS Sierra (there’s a simplified “elements” version for Sierra). Then I thought I should just edit the keyboard mapping directly. 🙂