Skip to content

Instantly share code, notes, and snippets.

@vadikgo
Last active October 17, 2024 07:23
Show Gist options
  • Save vadikgo/0ec180f8aa3324911c1daea305b92ece to your computer and use it in GitHub Desktop.
Save vadikgo/0ec180f8aa3324911c1daea305b92ece to your computer and use it in GitHub Desktop.
Remap HHKB Pro Eject key to Media Play/Pause

Remap HHKB Pro Eject key to Media Play/Pause

Run in a terminal

hidutil property --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0xC000000B8,"HIDKeyboardModifierMappingDst":0xC000000CD}]}'

Add remap on startup

Create a file ~/Library/LaunchAgents/com.nanoant.KeyRemapping.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.nanoant.KeyRemapping</string>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/bin/hidutil</string>
        <string>property</string>
        <string>--set</string>
        <string>{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0xC000000B8,"HIDKeyboardModifierMappingDst":0xC000000CD}]}</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
</dict>
</plist>

Run

plutil ~/Library/LaunchAgents/com.nanoant.KeyRemapping.plist

If you want to delete remap

hidutil property --set '{"UserKeyMapping":[]}'
@tglocicero
Copy link

It works! Thank you ❤️

@erenesmer
Copy link

it's great, thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment