18
$\begingroup$

The default keyboard shortcut (on Windows at least) for switching focus to the next window is Ctrl+F6, and for switching to the previous windows it's Shift+Ctrl+F6. How can I change this to Ctrl+Tab and Shift+Ctrl+Tab respectively (or some other pair of combinations which is not used by default)?

$\endgroup$
5
  • $\begingroup$ You'll want to see this... $\endgroup$ Feb 18, 2012 at 1:24
  • 1
    $\begingroup$ @J.M. this command doesn't appear to be in KeyEventTranslations.tr -- interesting. $\endgroup$
    – Mr.Wizard
    Feb 18, 2012 at 6:26
  • $\begingroup$ @Mr. Wizard: it's definitely not in Linux (that's why I couldn't post an answer); have you checked Windows by any chance? $\endgroup$ Feb 18, 2012 at 6:29
  • $\begingroup$ @J.M. yes, I am on Windows 7 and at least the command is not obvious if it is there; searching for "F6" reveals nothing. $\endgroup$
    – Mr.Wizard
    Feb 18, 2012 at 6:35
  • 2
    $\begingroup$ This discussion on Mathgroup might be of use here. $\endgroup$ Feb 18, 2012 at 13:30

2 Answers 2

21
$\begingroup$

You need to add the following to KeyEventTranslations.tr:

Item[KeyEvent["Tab", Modifiers -> {Control}],
   FrontEndExecute[FrontEndToken["CycleNotebooksForward"]]],

Item[KeyEvent["Tab", Modifiers -> {Shift, Control}],
   FrontEndExecute[FrontEndToken["CycleNotebooksBackward"]]],

This will map Control-Tab and Control-Shift-Tab to cycling between notebooks.

For some reason, using the Tab key sometimes fails, but any alternative shortcut could be used (for example Ctrl-`).

On Windows KeyEventTranslation.tr is located in

$InstallationDirectory\SystemFiles\FrontEnd\TextResources\Windows
$\endgroup$
3
  • $\begingroup$ For example, Item[KeyEvent["`", Modifiers -> {Control}], FrontEndExecute[FrontEndToken["CycleNotebooksForward"]]], works, too. $\endgroup$
    – Andrew
    Feb 18, 2012 at 14:46
  • $\begingroup$ Perhaps Ctrl+Tab fails sometimes because it is already mapped? $\endgroup$
    – Andrew
    Feb 26, 2012 at 16:31
  • $\begingroup$ This solution doesn't seem to work when I want to switch away from a minimized window. $\endgroup$
    – Andrew
    Feb 26, 2012 at 16:32
5
$\begingroup$

Apparently Ctrl+F6 and Ctrl+Shift+F6 are default Windows keyboard shortcuts, although I was only aware of the Tab variants.

Because of this, these commands on not (apparently) configurable from within Mathematica. Further, Mathematica does not recognize the Tab commands.


It may be possible to rig something using SetSelectedNotebook but so far I have failed to do this within the the confines of KeyEventTranslations.tr and MenuSetup.tr. Perhaps an EventHandler within a Palette could be made to work but I am tired of this problem.

$\endgroup$
2
  • $\begingroup$ Aha -- they're Windows's, not Mathematica's. $\endgroup$
    – Andrew
    Feb 18, 2012 at 13:38
  • $\begingroup$ FWIW, on a Mac it's CMD + `, and this does work within Mathematica by default. $\endgroup$ Jan 21, 2014 at 12:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.