Keyboard shortcuts are very effective time savers. For frequently used commands they are much quicker to execute than using the mouse to aim and click on a menu or toolbar item.
SketchUp allows its users to map their own keyboard shortcuts. The mapping of shortcut to command is based on the menu or toolbar button text. For menu items, the hierarchy of parent menu items also plays a role.
The SketchUp Ruby API has a method the returns an array of defined shortcuts:
Sketchup.get_shortcuts
Each item in the returned array is a string in the following format:
Shortcut Combination + Tab + Menu Position / Menu Text
Example:
"Ctrl+Shift+E\tCamera/Zoom Extents"
In the above example the shortcut combination Ctrl+Shift+E
is mapped to the Zoom Extents menu item under the Camera root menu.
As a plugin developer it is important to note that shortcuts are associated with the commands in this manner. If you add a menu item for your plugin under one menu, but later decide it better fits under another menu you will break any shortcuts your existing users has made to that menu item.
Ditto goes in case you need to change the wording or correct a typo. So take some time and consider and check your menu hierarchy and text before deploying your plugin.
One pattern I have observed several times is that the version number is included into the menu items and updated upon each release. A pattern that will break user’s shortcuts every time the plugin is updated.
All this applies to toolbars as well, the shortcuts for the buttons are mapped based on the name of the button and hosting toolbar.
[…] Use shortcut friendly action names […]