A CLI to set application-specific keyboard shortcuts for macOS
Requires Node.js.
$ cat shortcuts.json
{
"Figma": {
"Arrange": {
"Align Bottom": "cmd ctrl b",
"Align Horizontal Centers": "cmd ctrl h",
"Align Left": "cmd ctrl l",
"Align Right": "cmd ctrl r",
"Align Top": "cmd ctrl t",
"Align Vertical Centers": "cmd ctrl v"
},
"Plugins": {
"Distribute Layers": {
"Distribute Layers Left": "cmd shift l",
"Distribute Layers Right": "cmd shift r",
"Distribute Layers Up": "cmd shift u",
"Distribute Layers Down": "cmd shift d"
},
"Move Layers": "cmd shift m"
}
}
}
$ npx macos-keyboard-shortcuts set shortcuts.json
Set 11 keyboard shortcuts
See that:
- Root keys are macOS applications names.
- The “path” to each menu item is specified via a nested JSON object.
- The leaf values are the keyboard keys, separated by a space. Use
cmd
,ctrl
,opt
, andshift
for modifier keys, andup
,down
,left
, andright
for arrow keys.
Usage
$ macos-keyboard-shortcuts <command> [options]
Available Commands
set Sets the keyboard shortcuts as defined in the specified file
unset Unsets the keyboard shortcuts as defined in the specified file
For more info, run any command with the `--help` flag
$ macos-keyboard-shortcuts set --help
$ macos-keyboard-shortcuts unset --help
Options
-v, --version Displays current version
-h, --help Displays this message
$ npm install --global macos-keyboard-shortcuts