3

I created some services to be used in Finder. Now I wanted to create some keystrokes to call these services. That would be easy in the System Settings, however, I would like to add them from the command line in order to automate this setup.

I tried the following which did allow me not trigger the services by a keystroke:

defaults write com.apple.Finder NSUserKeyEquivalents '{ "label-red" = "$@1"; "label-green" = "$@2"; "label-none" = "$@0"; }'

Any ideas to make this work? Instead of com.apple.Finder I might have to use another identifier, but which?

1

You can use PlistBuddy and defaults:

/usr/libexec/PlistBuddy -c 'Delete NSServicesStatus:"(null) - test2 - runWorkflowAsService"' ~/Library/Preferences/pbs.plist 2>/dev/null;defaults write pbs NSServicesStatus -dict-add '"(null) - test2 - runWorkflowAsService"' '{key_equivalent = "^~@2";}'

The PlistBuddy command is not needed if there is not an existing entry for the service. Replace test2 with the name of the service. Quit and reopen applications to apply the changes.

^~@2 is control-option-command-2. See https://web.archive.org/web/20161220060333/http://osxnotes.net/keybindings.html.

|improve this answer|||||

You must log in to answer this question.

Not the answer you're looking for?Browse other questions tagged .