How to modify menus from init.m?
- To: mathgroup at smc.vnet.net
- Subject: [mg114399] How to modify menus from init.m?
- From: kj <no.email at please.post>
- Date: Fri, 3 Dec 2010 05:20:52 -0500 (EST)
I want to add new keyboard shortcuts, as well as new menu items,
to the Mathematica menus.
I have found some recipes online for doing this that involve editing
files like KeyEventTranslations.tr or MenuSetup.tr, but I would
*much* prefer to do this kind of customization from my init.m.
(The idea is to keep all my customizations in one place.)
Is it possible to do this?
I found a few tantalizing clues in the documentation, but nothing
I could actually use. For example, there's the function
FrontEndEventActions, but I can't get it to recognize events like
pressing Ctrl+E. E.g., if I evaluate
FrontEndEventActions[{"KeyDown", "Ctrl+E"} :> Print["OK"]]
...and then press Ctrl+E, nothing happens. I tried every variant I
could think of for specifying Ctrl+E, but none worked. (BTW, I
realize that there's already a keyboard shortcut for EvaluateNotebook,
at least on Windows, namely Alt+v followed (*quickly!!!*) by Alt+o,
but in my laptop the Alt key is very inconveniently placed, and,
in any case Ctrl+E, being shorter, is more of a shortcut than Alt+v
+ Alt+o.)
Similarly, I would like to add new custom-written commands to the
standard menus. For example, I want to add the command "Keyboard
Shortcuts", which brings up the page "tutorial/KeyboardShortcutListing".
How can I do any of this from within init.m?
TIA!
~kj