Karabiner-Elements can be used to run an open
shell command. It'll open it if the application is closed, and focus if it's already open. Example jsonIf you create cmd-numbers.json
in "complex_modifications"~/.config/karabiner/assets/complex_modifications/
, you'll see new rules in Karabiner under Complex modifications | Add rule:
{
"description": "Finder",
"from": {
"key_code": "1",
"modifiers": {
"mandatory": "command"
}
},
"to": {
"repeat": false,
"shell_command": "open -b com.apple.finder"
},
"type": "basic"
},
{
"title": "Launch apps with Cmd+<number>",
"rules": [
{
"description": "Finder",
"manipulators": [
{
"from": {
"key_code": "1",
"modifiers": {
"mandatory": "command"
}
},
"to": {
"repeat": false,
"shell_command": "open -b com.apple.finder"
},
"type": "basic"
}
]
},
{
"description": "Firefox",
"manipulators": [
{
"from": {
"key_code": "2",
"modifiers": {
"mandatory": "command"
}
},
"to": {
"repeat": false,
"shell_command": "open -a Firefox"
},
"type": "basic"
}
]
}
]
}