Last active
March 27, 2026 17:57
-
-
Save R44VC0RP/380055cc28ddead2f18396a35743115a to your computer and use it in GitHub Desktop.
Allows you to overwrite your cursor tab key to use it as a PTT key for your favorite dictation software.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Remap USB Tab Button to F20 (for PTT use with Superwhisper, Discord, etc.) | |
| # Works with generic USB tab key (VendorID: 0x8808, ProductID: 0x6600) | |
| VID="0x8808" | |
| PID="0x6600" | |
| PLIST="$HOME/Library/LaunchAgents/com.user.usb-button-remap.plist" | |
| # Check if device is connected | |
| if ! hidutil list | grep -q "0x8808.*0x6600"; then | |
| echo "ERROR: USB button not detected. Plug it in and try again." | |
| exit 1 | |
| fi | |
| echo "Found USB button (VID: $VID, PID: $PID)" | |
| # Apply remap now | |
| hidutil property \ | |
| --matching "{\"VendorID\":$VID,\"ProductID\":$PID}" \ | |
| --set '{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x70000002B,"HIDKeyboardModifierMappingDst":0x70000006F}]}' \ | |
| > /dev/null | |
| echo "Remapped Tab -> F20 on USB button" | |
| # Create Launch Agent so it persists across reboots | |
| cat > "$PLIST" << 'EOF' | |
| <?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.user.usb-button-remap</string> | |
| <key>ProgramArguments</key> | |
| <array> | |
| <string>/usr/bin/hidutil</string> | |
| <string>property</string> | |
| <string>--matching</string> | |
| <string>{"VendorID":0x8808,"ProductID":0x6600}</string> | |
| <string>--set</string> | |
| <string>{"UserKeyMapping":[{"HIDKeyboardModifierMappingSrc":0x70000002B,"HIDKeyboardModifierMappingDst":0x70000006F}]}</string> | |
| </array> | |
| <key>RunAtLoad</key> | |
| <true/> | |
| </dict> | |
| </plist> | |
| EOF | |
| launchctl unload "$PLIST" 2>/dev/null | |
| launchctl load "$PLIST" | |
| echo "Launch Agent installed -- remap will persist across reboots." | |
| echo "" | |
| echo "Done! Now set your PTT keybind to F20 in your app." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment