14
$\begingroup$

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.

$\endgroup$
5
  • 1
    $\begingroup$ 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. $\endgroup$
    – Jason B.
    Commented Nov 25, 2015 at 9:30
  • $\begingroup$ @JasonB Exactly ;) $\endgroup$
    – Kuba
    Commented Nov 25, 2015 at 9:31
  • $\begingroup$ 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 $\endgroup$
    – Jason B.
    Commented Nov 25, 2015 at 9:32
  • $\begingroup$ @JasonB That sounds similar to using FrontEndExecute[ FrontEndToken[FrontEndTokenExecute["New"], "TileWindowsTall"]]. $\endgroup$
    – Karsten7
    Commented Nov 25, 2015 at 10:05
  • $\begingroup$ @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 $\endgroup$
    – Jason B.
    Commented Nov 25, 2015 at 10:22

2 Answers 2

15
$\begingroup$

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

$\endgroup$
1
  • $\begingroup$ Comments are not for extended discussion; this conversation has been moved to chat. $\endgroup$
    – Kuba
    Commented Apr 4, 2019 at 21:01
10
$\begingroup$

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

$\endgroup$
2
  • 2
    $\begingroup$ 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]. $\endgroup$
    – Karsten7
    Commented Nov 25, 2015 at 10:42
  • $\begingroup$ It took me a while to find that file, on Linux it is at $InstallationDirectory <>"/SystemFiles/FrontEnd/TextResources/X/MenuSetup.tr" $\endgroup$
    – Jason B.
    Commented Nov 25, 2015 at 11:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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