This class allows control over items displayed in the sclang application-level menu. Application-level menus may not exist depending on platform — in particular, macOS and some Linux window managers have it, but Windows does not. On platforms without this feature, the methods in this class simply don't do anything.
Register a MenuAction to a main application menu. This menu item will exist for the duration of the app, or until .unregister is called for the action.
A String, representing the name of the top-level menu to contain the action.
An optional string. Action will be placed in a section of the menu with other members of the same group, with a separator between items of other groups.
MainMenu.register provides an easy way to register global menu items, in a way that helps avoid disrupting menus registered by other SuperCollider components.
If you want to register menus for personal use, add the registration calls to your startup.scd file. This will ensure the menus are created automatically on launch.
If you're registering menu actions for a Quark or other component intended for distribution, be sure to be polite and thoughtful about where you're registering actions.
Avoid creating new top-level menus if possible - instead, try to use one of the following canonical menus to register your actions. Add your actions to a group to ensure you don't collide with actions from another component:
If registering menu items for a Quark, consider registering as a sub-menu of the Quarks menu. This can easily be done using the MainMenu: registerQuarkMenu method.
Convenience method for registering a menu of functionality related to a Quark. It will appear as a sub-menu under the main Quarks menu.
A String, the name of the quark
A Menu, a menu.
Remove a MenuAction that has been registered previously.
menuAction.enabled = false;rather than removing it.
A list of menus to append to the set of main application menus.
The main SuperCollider application menu.