2
$\begingroup$

Is there a way to customize the default toolbar in Mathematica 13? I would like to add a new icon to the toolbar, which triggers a popup menu containing several frontend operations I can customize (such as tagging cells and inserting automatic numberings). I imagine its behavior should be similar to the hyperlink icon:

enter image description here

$\endgroup$
1
  • 3
    $\begingroup$ The current toolbar does not support end user customizations. We know there is a good amount of interest in that. $\endgroup$
    – ihojnicki
    May 6, 2023 at 20:59

1 Answer 1

2
$\begingroup$

I'm afraid we can't do that. However your need may be met in some other ways.


Why I feel it impossible

Mathematica provided a menu item placed in the menu Window/Toolbar. This item is parallel to Ruler etc., these items are toggled by several FrontEndTokens, while their neighborhoods Templating and Testing are DockedCells toggled by KernelExecute. In fact, these menu items change the absence of "MultipurposeBar" element in the notebook option WindowToolbars.

This seems to imply that this toolbar is a raw Qt frontend object, instead of something represented and controlled by a WL expression.


What can you do

For a customized menu, you can try adding you own DockedCells(by SetOptions) or integrating your buttons into the menubar(by modifying MenuSetup.tr).

The former way is usually preferred if you want this utility to be limited in some notebooks instead of be a global setting. WRI's Package.nb creates DockedCells in stylesheets, template notebooks set this option for each specific notebook.)

IMO, an advantage of the latter way is that you can have a keyboard shortcut with a better performance(compared to FrontEndEventActions).

The WL funciton for menus is ActionMenu, while its box representation is ActionMenuBox. With some knowledge of cell/box and proper Appearance option, you can easily achieve your goal.

BTW, WRI also provides palletes for such things. However I often feel those extra windows disturbing.

$\endgroup$

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.