Using Ctrl+n we are effectively doing FrontEndTokenExecute["New"] and, at least on Windows, a new window has a WindowSize equal to the current Input/Selected Notebook's WindowSize.

Can Ctrl+n produce a notebook with fixed/predefined size? Is there any option for that?


This method works for things like CreateDocument etc. but not for my case.

There is also something like CurrentValue["DefaultWindowSize"] but it doesn't seem to affect Ctrl+n.

  • 1
    This would be great - I hate it when the new window opens in full screen mode because I had the window I was in maximized. And I'm the type to open 20 windows in the course of perfecting a new function. – Jason B. Nov 25 '15 at 9:30
  • @JasonB Exactly ;) – Kuba Nov 25 '15 at 9:31
  • When I used Windows, I would take advantage of the 'Tile windows tall' menu option, but I don't think it is available for Linux – Jason B. Nov 25 '15 at 9:32
  • @JasonB That sounds similar to using FrontEndExecute[ FrontEndToken[FrontEndTokenExecute["New"], "TileWindowsTall"]]. – Karsten 7. Nov 25 '15 at 10:05
  • @Karsten7 - thanks for that, it doesn't work perfectly for sure, but at least it puts all the available windows in a reasonable space. Though if you have two monitors, both widescreen, then the resulting windows are far from ideal – Jason B. Nov 25 '15 at 10:22
up vote 13 down vote accepted

If you don't want to modify MenuSetup.tr you can evaluate:

SetOptions[
 $FrontEnd,
 NotebookEventActions :> {
   {"MenuCommand", "New"} :> CreateNotebook["Default"]
   }
 ]

which will add this to user's FrontEnd/init.m

"MenuCommand" example

If one feels comfortable modifying MenuSetup.tr, replacing its seventh line with

            MenuItem["&Notebook (.nb)", KernelExecute[CreateNotebook["Default"]], MenuEvaluator->"System", Method -> "Queued", MenuKey["n", Modifiers->{"Control"}]],

will result in Ctrl+n creating a new notebook with a window size of CurrentValue["DefaultWindowSize"].

  • 1
    As stated in the documentation "CreateNotebook allows any notebook option to be given." Therefore, if one prefers another WindowSize, one can for example use CreateNotebook["Default", WindowSize -> Small]. – Karsten 7. Nov 25 '15 at 10:42
  • It took me a while to find that file, on Linux it is at $InstallationDirectory <>"/SystemFiles/FrontEnd/TextResources/X/MenuSetup.tr" – Jason B. Nov 25 '15 at 11:11

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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