What is it?
Shortcuts is a Mac OS X application to assign hot keys to contextual menu items. It works only with menu items added by contextual menu plug-ins. Version 2.0 also allows you to display a menu with items added by CM plug-ins.
Mac OS 10.5 or higher.
Some useful contextual menu plug-ins highly recommended.
In Mac OS 10.6 and 10.7 Shortcuts is the only method to use contextual menu plug-ins in 64 bit applications.
Ever wanted to assign a hot key combination to contextual menu item? "Shortcuts" is the answer. It allows you to assign a hot key combination to chosen menu item so you can select some object (file in Finder or text) and hit keyboard combination to execute the task normally performed by choosing that menu item.
Shortcuts works with contextual menu plug-ins only. It does not work with menu items added by the application which shows the menu. For example, when you ctrl-click on Desktop in Finder you have "New Folder" and other items added by Finder. You cannot assign shortcuts to those items. But the same contextual menu also shows some items added by plug-ins — in default Mac OS 10.4 installation it would see Automator and folder actions items which are added by Apple-provided plug-ins — and you can assign shortcuts to those items. Of course you probably need to have some third party contextual menu plug-ins installed to make good use of "Shortcuts". But even if you used it only for one frequently used item it would be worth installing and getting the benefits of much faster execution.
Unfortunately not all contextual menu plug-ins will work with "Shortcuts". Only contextual menu items which play by the rules will work. So what are the rules? The rules are: when the context information (selected text of file information) is passed to the contextual menu plug-in, it should advertise available commands by returning the menu item name. It seems obvious but some plug-ins do it in a different way. They do not provide the names of their contextual menu items when asked and they try to add those items to menu later. You will not be able assign shortcuts to those items because in most cases they will not show up at all when "Shortcuts" tries to query all plugins. Another class of problematic plug-ins are those which restrict their visibility to certain applications only — for example some plug-ins may show only in Finder. In such case "Shortcuts" will not see their items.
A. Mac OS 10.5:
Copy "Shortcuts32" to your "Applications" folder before starting it. If you are upgrading from previous version, make sure you stop "ShortcutObserver", remove it from login items and remove "CocoaTextSelectionHelper". All this can be done from the first panel in "Shortcuts". So it is recommended to start old version of Shortcuts, perform the cleanup, quit and then replace with new version.
You need to log out to make Shortcut service available in Services menu.
B. Mac OS 10.6 and 10.7:
There is a 64 bit version of Shortcuts, just named Shortcuts.app and 32 bit version named Shortcuts32.app.
If you have 64-bit CM plug-ins, put Shortcuts.app in your Applications folder. Note that majority of contextual menu plug-ins will never be upgraded to 64 bit becuase Apple disabled CM plug-ins for 64 bit applications in Mac OS 10.6. For more information on this topic see here. We plan to upgrade most Abracode plug-ins to 64 bit version for optimal performance. If you use only Abracode 64 bit plug-ins you may not need the Shortcuts32.app at all (that is our long term goal).
If you have 32 bit CM plug-ins (currenlty the majority of our plug-ins and other companies' plug-ins), you will need Shortcuts32.app as well. Both Shortcuts versions are designed to coexist so you may install both 64 and 32 versions side by side. You just need to be careful not to assign the same shortcut combinations to items in 32 and 64 bit versions.
If you are upgrading from previous version of Shortcuts, follow steps described above for Mac 10.5 to stop the observer and remove the text helper.
If you want to get access to Shortcuts CM items menu from new services context menu, you will need to log out and log back. The system will update the list of services and you should be be able to see and turn on Shortcuts services in "System Preferences". They are named "More Items (32 bit)..." and "More Items (64 bit)..." and will be available in "Text" category:
and down below in "General" category:
Make sure the boxes are checked to get those items to work in Mac OS 10.6 and 10.7 contextual menu items.
"Shortcuts" solution consists of several components working together. All is wrapped in one application: Shortcuts. But inside we have a small, background-only application named "ShortcutObserver". This application must be running in order to capture your hot key, load the proper plug-in and execute the command. "Shortcuts" provides an easy way to start and stop "ShortcutsObserver". It also provides a way to add "ShortcutObserver" to login items so the background app can start each time you login. In 32 bit version there is also a helper plug-in called "CocoaTextSelectionHelper". This bundle is an Input Manager plugin. It is installed in ~/Library/InputManagers/. It is an optional helper to get text selection from front text view (aka first responder) in Cocoa applications. Apple removed Input Manager plugin support in 64 bit apps so there is no plug-in and no equivalent support for getting text from Cocoa apps.
Finally, there are context providing scripts written with AppleScript described in section below.
Shortcuts uses a compact interface in five panels. Use first panel to start "ShortcutObserver", add it to login items and install the helper bundle. You can also turn on the bezel window notification. If this option is on and you press the assigned key combination, a transparent window with executed command name will appear for a couple of seconds.
The second panel is for assigning hot keys to contextual menu items. It might seem complicated at first look but when you get an understanding of how it works, you will find it easy to use. Think of this panel as a contextual menu simulator to test what items will show for given context information. There are three sections in this panel for three most popular context data types: text, file and folder. On the left side you can enter example data to feed the contextual menu plug-ins and ask for advertised services. On the right side you have a popup menu which displays items obtained from plug-ins. Depending on the data provided on the left side you will see different menu items on the right side. For example: if you choose a picture file in the second section you may see items which show only for pictures.
You probably wonder what the text in red means. Items in red are the ones which have a hot key combination already assigned — these are the "hot" items.
The screenshot below illustrates another contextual menu simulation. This time we are looking at items that would show if you control-clicked on text selection. Remember that it is a simulation — when you choose a menu item, you will not execute the command but a sheet dialog will be displayed to enter a keyboard shortcut.
The small sheet dialog to assign hot key combination is shown below. Choose your keyboard combination wisely to avoid conflicts with existing hot keys. Your key combination may conflict with front application hot keys or with global shortcuts set in "System Preferences" -> "Keyboard & Mouse" -> "Keyboard Shortcuts". It may also conflict with other third party hot key observers if you installed any. One rarely used combination is Control+Option+Command+Some Key. It is easy to remember because those are the three neighbor key modifiers and the chance for conflict with most applications is small.
The third panel allows you to assign a keyboard combination to show the contextual menu with items added by all CM plug-ins. By default there is no key assigned.
If you enable Shortcuts services in System preferences, you will be able to access your contextual menu items from "More Items..." service menu item. In Mac OS 10.6 it will be in contextual menu:
When you choose it, a new menu will show with items populated from contextual menu plug-ins.
The fourth panel contains the list of active shortcuts. You may change the hot key combination or remove the shortcut entirely. The menu item is displayed as pseudo path with submenus and menus separated by forward slash: "/". Forward slash at the beginning indicates the root menu.
Context providing scripts
AppleScript context providers is a bridge between ShortcutObserver and the front application. You can think of those as plug-ins for ShortcutObserver. Several scripts for popular applications are provided by Abracode. You may add scripts for applications you use (if those applications are scriptable of course). The script name must match the host application name as displayed in the menu bar (top left, next to Apple menu). Why those scripts are needed? In order to understand why they are needed and how they are used, one must get familiar with the way ShortcutObserver works and how it differs from regular contextual menu invocation. Contextual menus, as the name suggests, work with some context information, usually selected text, file, folder or other object. Host application, the one showing the contextual menu, is responsible for passing the context data to the plug-in when asking for advertised services. With ShortcutObserver the situation is slightly different: the host application still needs to provide the context data but it is the ShortcutObserver which loads the plug-in, gets the context data from front application and then passes that data to plug-in and asks it to execute the command. ShortcutObserver is the app which handles everything after it gets invoked with hot key combination. The problem is that ShortcutObserver needs to get the context information from front application so it needs to talk to that application somehow. Finder is the most important application with many contextual menu plug-ins written for it so ShortcutObserver has a built-in protocol to talk to Finder (via AppleEvents) to get currently selected file or folder information. Another built-in plug-in is for obtaining current text selection from Cocoa applications (only in 32 bit). It is done via optional "CocoaTextSelectionHelper" mentioned earlier. The extra benefit of this approach is that some contextual menu plug-ins which normally don't work in Cocoa applications would get a way to obtain the information about currently selected text. So those two cases are taken care of but for other applications you need special scripts.
There are two types of scripts currently supported. One type is for obtaining text data, the other is for file or folder data. Scripts providing text context should ask the host application to get current selection as Unicode text. File/folder scripts on the other hand should get the alias of currently selected object (or a list of aliases). You may notice scripts under "File/Folder" category which get file information from text editors for example. At first look it may seem that it does not make sense to get file information from application which primarily deals with text. The "context" idea is extended in this case. The file information associated with the front window may be the location of the document you are editing (while the text context would still be the selected text in that window). This gives you an additional benefit: you may perform an operation on front document in some editor as if you control-clicked on its file in Finder. For example: imagine a plug-in which changes privileges of read-only files to read-write — now imagine you opened a read-only file in TextEdit and you realized you cannot modify it — with Shortcuts you may have a keyboard combination to make it writable in a fraction of a second. All this is possible because when you assign hot key in Shortcuts you do it specifically for text, file or folder context and Shortcuts saves this information. When the command is invoked, ShortcutObserver "knows" what is the preferred context type: text or file and acts accordingly executing the text or file context provider script.
1. Not all contextual menu plug-ins work with Shortcuts. In most cases there is not much that can be done about it but ask the author of the plug-in to change the code to work with Shortcuts.
2. There might be conflicts with other hot key combinations assigned by other applications.
2.0.2 August 10, 2011
- Fixed a problem in Mac OS 10.7 that bezel window would not show if ShortcutObserver is started as a log-in item
- Some magic to make "More Items..." checkbox on by default in Services/Keyboard Shortcuts, not requiring users to go to System Preferences to enable it after initial installation.
2.0.1 January 24, 2010
- Added support for keyboard modifiers showing alternate menu items in displayed menu
- Added support for keyboard shortcuts for standard actions in Cocoa windows displayed by contextual menu items (copy, paste, close window, etc).
- Fixed the problem of adding ShortcutObserver to login startup items after fresh Mac OS X installation
2.0 August 29, 2009
- Added the ability to show contextual menu with plug-in items with a keyboard hot key or from services menu
- 64 and 32 bit versions for Snow Leopard
1.1.3 February 20, 2008
- Fixed CocoaTextSelectionHelper plug-in permissions so it can be loaded in Mac OS 10.5
1.1.2 November 3, 2007
- Updated for full Leopard compatibility
1.1.1 April 12, 2007
- Fixed a crash when assigning a hot key
1.1 April 3, 2007
- Fixed a problem with some contextual menu plugins generating dynamic menu items in a specific way. This change makes PicturePopPro 2 items visible in Shortcuts.
- Added a checkbox to simulate multiple file or folder selection. This is needed for CM plug-ins which display different menu items when you click on more than one file or folder. One specific example of such plug-in is FileUtilsCM.
- Added conflict warnings when you try to assign the same hot key as one of the global hot keys active in "System Preferences" -> "Keyboard & Mouse" -> "Keyboard Shortcuts" or key combinations in "Services" menu.
1.0 May 4, 2006