To programmatically add to menus you can do as described here:

How do I add new menuitems to menus?

What can I do to programmatically add to contextual menus? Is something similar to AddMenuCommands available?


1 Answer 1


There's an option ContextMenu, which you seem to be able to set at cell, notebook, or even box level. They all default to something like

FEPrivate`FrontEndResource["ContextMenus", "something"]

That info seems to be in the ContextMenus.tr file in the $InstallationDirectory, SystemFiles, FrontEnd, TextResources.

In any case, all that that option needs is a list of MenuItem[...]. You can look at that file (or at MenuSetup.tr) to get a hang on the syntax. Then it's just setting the option.

Apart from the brute force method of reading the file, creating your own, adding your Menus, and setting that option, I still haven't found a way to "append" the MenuItems. Only to replace... I'll edit if I find something

  • 8
    $\begingroup$ You're right...you can't append menu items. But you missed a second source of context menus...the ComponentwiseContextMenu option. ContextMenu is used where you can easily dictate context menus by style, whereas ComponentwiseContextMenu allows you to determine context menus which belong to certain box types, the various cell-related widgets, etc., which may be difficult or impossible to apply styles to. $\endgroup$
    – John Fultz
    Commented Mar 6, 2012 at 15:52
  • $\begingroup$ @JohnFultz Would you have some hints about getting context menus to show up in specific graphics elements in this question? $\endgroup$
    – QuantumDot
    Commented Aug 19, 2022 at 17:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.