More (mechanical) keyboards and Mac key remapping

After browsing too much r/MechanicalKeyboards I bought some more keyboards… 😀

One is a white TKL CODE with 65g Zealios switches
White TKL CODE with 65g Zealios switches
(which is essentially the same as my current WASDv2 except for the case color, switches and lighting), which I bought because I was interested in the Zealios switches, and this is one of the few pre-made keyboards that offer them.

The other was a birthday present to myself and is a Leopold FC660C (Topre) in Grey & Blue:Leopold FC660C (Topre) in Grey & BlueThe Leopold does not have a Mac specific mode (although you can use its DIP switches to swap the Windows and Alt key, but that doesn’t get you ⌘ to the right of the space bar).

Therefore I fiddled a bit with remapping some keys for these keyboards for macOS use. One option for the Leopold FC660C is Hasu’s Alt Controller which replaces the controller board itself with a fully programmable one. Another option is to use Karabiner to remap the keys at the software level, but I found the CPU usage of Karabiner’s karabiner_grabber process a bit too high for what it should be doing. Since macOS 10.12 there’s another way to remap keys using hidutil.

My configuration (for both keyboards) looks as follows (stored inside ~/bin/ which is run on login, based on this script):

#!/usr/bin/env bash






# WASDv2 / CODE in Mac mode
hidutil property --matching '{"ProductID":0x269, "VendorID":0x4d9}' --set "{\"UserKeyMapping\":[
{$FROM: $F13,          $TO: $MEDIA_EJECT},
{$FROM: $F14,          $TO: $MEDIA_PREV},
{$FROM: $F15,          $TO: $MEDIA_NEXT},
# Leopold FC660C
hidutil property --matching '{"ProductID":0x134, "VendorID":0x853}' --set "{\"UserKeyMapping\":[
{$FROM: $PAUSE,        $TO: $MEDIA_NEXT},

Mainly this maps the modifier keys to be more Mac-like, caps lock to escape (which means I can run the Leopold’s escape key permanently in ` / ~ mode (using Fn + Q), as well as some media keys. The links in the header-comment of the script contain lists of supported pages and usages; the page is the upper 32-bit word and the usage the lower 32-bit word.

If you want to run this on login, you can use launchd by storing a plist in ~/Library/LaunchAgents/de.maven.remap_keys.plist for example containing

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "">
<plist version="1.0">

Happy hacking!

6 thoughts on “More (mechanical) keyboards and Mac key remapping

  1. Val

    Hi there! Thanks for the walkthrough!
    I’m wondering, I want to remap my Leopold FC750R but have it a bit different from yours. Where could I find a list of all available functions, like the ones below?

    Specifically I’m interested in adding a volume up and volume down.
    Also, does pressing media_play a second time pause the media?

    Thank you!

  2. [maven] Post author

    The “functions” are the USB key and page identifiers, some of which are linked at the top of the script. Without having tried it, I’d look into the IOHIDUsageTables.h at the kHIDUsage_Csmr_VolumeIncrement / -Decrement values, so that instead of “0xC000000B0” for play / pause, you could try “0xC000000E9” and “0xC000000EA” to see whether that works.

  3. Anonymous

    Thank you! Do you have any recommendations on where to get topre-compatible keycaps for the mac command key?

  4. [maven] Post author

    I haven’t seen any Topre keycaps that include Mac command keys (but I also haven’t looked too hard). But in general, they seem rare enough as it is.

Leave a Reply

Your email address will not be published. Required fields are marked *