14

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.

Kuba
  • 136,707
  • 13
  • 279
  • 740
  • 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 09:30
  • @JasonB Exactly ;) – Kuba Nov 25 '15 at 09: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 09:32
  • @JasonB That sounds similar to using FrontEndExecute[ FrontEndToken[FrontEndTokenExecute["New"], "TileWindowsTall"]]. – Karsten7 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

2 Answers2

15

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

Kuba
  • 136,707
  • 13
  • 279
  • 740
10

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"].

Karsten7
  • 27,448
  • 5
  • 73
  • 134
  • 2
    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]. – Karsten7 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