Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save tomkinsc/d2a23232482ab89b31e31abd359a9029 to your computer and use it in GitHub Desktop.

Select an option

Save tomkinsc/d2a23232482ab89b31e31abd359a9029 to your computer and use it in GitHub Desktop.
This script instructs macOS to remap space characters from a given HID device VendorID and ProductID to a null character, thus ignoring space input. Intended to exclude space characters coming from non-keyboard HID devices that may insert them for some reason, such as the "iP54 OriginCal Absolute Digital Calipers with Smart Wireless Data Output,…
#!/bin/bash
# This instructs macOS to remap space characters from a given HID device VendorID and ProductID to a null character, thus ignoring space input.
#
# Intended to exclude space characters coming from non-keyboard HID devices that may insert them for some reason,
# such as the "iP54 OriginCal Absolute Digital Calipers with Smart Wireless Data Output."
# Change these values as needed to suit a particular HID device.
# Relevant values can be found via `system_profiler SPBluetoothDataType`
# The values below are for the "iP54 OriginCal Absolute Digital Calipers with Smart Wireless Data Output"
VENDOR_ID="0x1345"
PRODUCT_ID="0x022C"
sudo hidutil property \
--matching '{"VendorID":'$VENDOR_ID', "ProductID":'$PRODUCT_ID'}' \
--set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x70000002C, "HIDKeyboardModifierMappingDst":0x700000000}]}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment