Open SConaway opened 3 years ago
@SConaway Yes, definitely. I would be happy to merge this feature.
@SConaway would you mind giving an example how it is exactly done? 1) How to identify the correct Product ID 2) Where exactly to put the code line in the xml I would really appreciate your help!
Hi, I'm so sorry for delay, @PixelBaer.
You can use System Information's USB pane to get this information. I suggest using the VendorID and ProductID to get the best match. This is an example from a USB device I have connected right now:
Per hidutil property --help
, the added code would fit like this in the raw command hidutil property --matching '{"ProductID":0x54c,"VendorID":746}' --set ...
. Therefore, I suggest adding it like this right after the <string>property</string>
line:
<?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.local.KeyRemapping</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/hidutil</string>
<string>property</string>
<string>--matching</string>
<string>'{"ProductID":0x503,"VendorID":0x5ac}'</string>
<string>--set</string>
<string>{"UserKeyMapping":[]}</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
Do note that System Information provides the values in a hex encoding, so make sure they start with 0x
in the XML. I don't have a USB keyboard at the moment to test with, but I believe that should work.
Good luck!
@SConaway thanks a lot for coming back to my comment and for your thorough response! I will definitely give it a try
+1, this would be amazing. Especially if the device ID can be determined from a simple shell command and pasted into the tool.
Hi @amarsyla,
Would you be interested if I created a PR to add support for only applying this configuration to a specific device? You basically just add
--matching '{"ProductID":<USB PID>}'
in the command. I'm willing to do this, just want to know if you'd be interesting in merging it.