List currently defined keyboard shortcuts

I realized I kept defining keyboard shortcuts that I already had, simply because I had forgotten about them. So I made a small script to print the full list.

The output uses tabs, so it should be easy to copy and paste into Excel.

Here is the script:

import Rhino

shortcuts = Rhino.ApplicationSettings.ShortcutKeySettings.GetShortcuts()
rows = []
for shortcut in shortcuts:
    key = shortcut.Key
    if shortcut.Modifier:
        modifiers = str(shortcut.Modifier).replace("MacCommand", "Ctrl").split(", ")
    else:
        modifiers = []
    rows.append(["+".join([*modifiers, str(key)]), shortcut.Macro])

rows.sort(key=lambda r: r[0].lower())
print("Shortcut\tMacro")
for shortcut_text, macro in rows:
    print(f"{shortcut_text}\t{macro}")
1 Like