Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Add a menu item in a Wolfram desktop system
| ResourceFunction["AddMenuItem"]["after",item] adds a new menu item to the Wolfram sytem front end after the specified menu item. | |
| ResourceFunction["AddMenuItem"][token,{item1,item2,…}] adds several menu items. | 
Create an alternative menu item for maximizing the input notebook window after the Close Other Windows menu item:
| In[1]:= | ![ResourceFunction["AddMenuItem"]["CloseOthers", MenuItem["Maximize", KernelExecute[
   SetOptions[InputNotebook[], WindowMargins -> {{0, 0}, {0, 0}}, WindowSize -> Automatic]], "MenuKey"["m", "Modifiers" -> {"Shift", "Control"}], MenuEvaluator -> "System"]]](https://www.wolframcloud.com/obj/resourcesystem/images/579/579d5693-22c6-4357-b960-215eddf5e769/01be58c23e4b4e98.png) | 

The current window size:
| In[2]:= | ![Options[InputNotebook[], WindowSize]](https://www.wolframcloud.com/obj/resourcesystem/images/579/579d5693-22c6-4357-b960-215eddf5e769/3250d9f22c377251.png) | 
| Out[2]= |  | 
Choose the new menu item or press the keyboard shortcut to maximize the current notebook window and check the new window size:
| In[3]:= | ![Options[InputNotebook[], WindowSize]](https://www.wolframcloud.com/obj/resourcesystem/images/579/579d5693-22c6-4357-b960-215eddf5e769/3b7d6ee4230bd2b0.png) | 
| Out[3]= |  | 
Add a delimiter and a menu item for opening the Function Repository webpage:
| In[4]:= | ![ResourceFunction[
 "AddMenuItem"]["SelectionHelpDialog", {Delimiter, MenuItem["Function Repository", FrontEndExecute[{FrontEnd`NotebookLocate[{URL[
        "https://resources.wolframcloud.com/FunctionRepository"], None}]}]]}]](https://www.wolframcloud.com/obj/resourcesystem/images/579/579d5693-22c6-4357-b960-215eddf5e769/4edee9f6c00abf47.png) | 

See possible menu item tokens to place new items after:
| In[5]:= | ![Cases[Import@
  First@TakeSmallestBy[
    FileNames["MenuSetup.tr", FileNameJoin[{$TopDirectory, "SystemFiles", "FrontEnd", "TextResources"}], Infinity], Length[FileNameSplit[#]] &, 1], MenuItem[_, s_String, ___] :> s, {1, Infinity}]](https://www.wolframcloud.com/obj/resourcesystem/images/579/579d5693-22c6-4357-b960-215eddf5e769/00ec635bc69c45da.png) | 
| Out[5]= |  | 
Menu items created with AddMenuItem can be removed with the resource function RemoveMenuItem:
| In[6]:= | ![ResourceFunction["AddMenuItem"]["AllWindowsFront", MenuItem["Open Dialog", FrontEnd`KernelExecute[
   CreateDialog[{TextCell["Close me"], DefaultButton[]}]], MenuEvaluator -> Automatic]]](https://www.wolframcloud.com/obj/resourcesystem/images/579/579d5693-22c6-4357-b960-215eddf5e769/145dac94b86a037a.png) | 
| In[7]:= | ![ResourceFunction["RemoveMenuItem"]["Open Dialog"]](https://www.wolframcloud.com/obj/resourcesystem/images/579/579d5693-22c6-4357-b960-215eddf5e769/1e5058665216a8d5.png) | 
This work is licensed under a Creative Commons Attribution 4.0 International License