Skip to content

Instantly share code, notes, and snippets.

@carlossg
Created February 23, 2021 20:35
Show Gist options
  • Save carlossg/e24c9af7df03ff13ee7f596fe6bca067 to your computer and use it in GitHub Desktop.
Save carlossg/e24c9af7df03ff13ee7f596fe6bca067 to your computer and use it in GitHub Desktop.
Remote control key re-mapping in macOS
#!/bin/bash -eux
# Remote control key re-mapping in macOS
# Maps right arrow to M so you can mute/unmute in BlueJeans
# You'll need to determine your specific ProductID
# You can find ProductIDs for internal and external devices at the following location:
# Apple icon > About This Mac > System Report > USB (under Hardware section in left panel)
# These changes will be reverted after each restart.
# Based on https://stackoverflow.com/a/58981641/1815832
product_id=0xB505 # logitech remote
src=4F # right arrow
dst=10 # M
hidutil property --matching "{\"ProductID\":${product_id}}" \
--set "{\"UserKeyMapping\": [
{ \"HIDKeyboardModifierMappingSrc\":0x7000000${src},
\"HIDKeyboardModifierMappingDst\":0x7000000${dst}
}
]}"
hidutil property --get UserKeyMapping --matching '{"ProductID":0xB505}'
# undo
#hidutil property --set --matching '{"ProductID":0xB505}' '{"UserKeyMapping":[]}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment