I want to be able to toggle the "Tap to Click" setting under "Trackpad" > "Point & Click" in the System Settings app with a key combination from within any application.
I looked at "Keyboard" > "Shortcuts", but the options here look pretty limited. "App Shortcuts" seem to be the closest thing — it appears you can bind a key to an option in pull-down menus on the top menu bar, but if there's a way to bind a key to a toggle in the System Settings app pane, it's not clear to me.
Perhaps this is something that's better done by AppleScript (or system-hooked JavaScript)? Or triggering a command-line option?
Best Answer
Since you didn't say what version of macOS you are running, here is the AppleScript code I'd use to toggle the target checkbox under macOS High Sierra. It may need to be modified for macOS Mojave and later.
Also note that when assigning a global keyboard shortcut, it can not be one already assigned to any app that has focus when the keyboard shortcut is pressed.
You can use this code in a Run AppleScript action in an Automator Service.1
The keyboard shortcut can be assigned in: System Preferences > Keyboard > Shortcuts > Services
Example AppleScript code:
Note: The example AppleScript code is just that and does not contain any additional error handling as may be appropriate. The onus is upon the user to add any error handling as may be appropriate, needed or wanted. Have a look at the try statement and error statement in the AppleScript Language Guide. See also, Working with Errors.