Quickly create/edit keyboard shortcuts for menu items Currently, if I want to bind a new keyboard shortcut to a menu item, I need to go through a somewhat tedious, many-step process:


Open System Preferences, then Keyboard pane, then App Shortcuts
Click the + button
Find the application in the menu
Forget the exact name of the menu item I want to bind
Go back to the other application, find the menu item, remember exactly what it’s called
Go back to System Preferences and type that in the field
Type the desired shortcut and click “Add”
On testing it out, find that I somehow mistyped it and spend a couple minutes troubleshooting steps 5–7


For something so simple as binding a keyboard shortcut to a menu item, I feel like there should be a very easy way to achieve this in about two seconds.

Is there some sort of script or app which I can use to easily manage an app's keyboard shortcuts?

I would be equally happy with something resembling either of these:


A small script/background app which I can call, which prompts me to select a menu item and type my desired shortcut
A somewhat larger program which will list and let me edit every menu item and/or keybinding within a certain app
Here's the AppleScript for it:

on run

tell application "System Events"
    set theActiveApp to name of 1st process whose frontmost is true
end tell

set theApplicationID to id of application theActiveApp
set theMenuItem to text returned of (display dialog "Enter menu item name" default answer "Example: New Window")
set theShortcut to text returned of (display dialog "Enter shortcut (use these: ⌘=@,  ⌥=~,  ⇧=$,  ^=^)" default answer "Example: @$1")

do shell script "defaults write " &amp; quoted form of theApplicationID &amp; " NSUserKeyEquivalents -dict-add " &amp; quoted form of (quote &amp; theMenuItem &amp; quote) &amp; " " &amp; quoted form of (quote &amp; theShortcut &amp; quote)

end run


So, it gets the current application's identifier and then adds your menu item name and shortcut as required. You can even click the application's menu bar without the popup going away!

However, note that this is merely a rudimentary version of what you wanted; it only adds entries. If you make a mistake, that's yours to manually fix (and it might not appear in System Preferences). Also, lastly, it did not seem to work in Automator or Script Editor, but worked fine for the Finder. As for the former two, it adds the entries but for some reason they don't show up in System Preferences and can't be used, even after restarting the app. I don't know why but hey, at least it's something ;)