Which commands can you put in KeyEventTranslations.tr ?
There is an extensive list of FrontEndTokens, but what else can you use? Why something like this doesn't work:
Item[KeyEvent["r", Modifiers -> {Command}],
FrontEndExecute[{
FrontEnd`KernelExecute[ToExpression["Quit[]"]],
FrontEndToken[SelectedNotebook[], "EvaluatorStart", "Local"]
}]
],
With FrontEnd``KernelExecute` one could put any command there, but what's the trick?
Edit (some more observations)
This does work in MenuSetup.tr, like explained here (and of course in the current session). Menu items can be executed by a Kernel or FrontEnd. However, for each item there can be only one MenuEvaluator, so after quitting Kernel the rest of commands will not be executed.
Also, for some reason, KernelExecute, when started from Menu or a button (not from a Cell), is not only queued to Kernel, but has priority!
KeyEventTranslations.tr? What else can one put there besides FrontEnd tokens? – Vladimir Mar 13 '13 at 11:58$UserBaseDirectoryMathematica will load it preferably to the original one in$InstallationDirectory? – Vladimir Mar 14 '13 at 11:44FrontEndExecute[KernelExecute[...]]:D – Vladimir Mar 14 '13 at 12:52MenuItem["Quit Current Kernel",KernelExecute[SystemModule[{nb},nb =SystemNotebookPut[SystemNotebook[{SystemCell["Quitting Kernel!", "Title",TextAlignment -> Center]},SystemWindowMargins -> {{300, 300}, {300, 300}}]];SystemPause[1];SystemNotebookClose[nb]];SystemQuit[];],MenuEvaluator -> Automatic,MenuKey["Escape", Modifiers ->{"Control"}]]All I'm missing is something likeSystemStartKernel[]` for this to be practical. – Charlotte Hadley Jun 18 '13 at 05:58