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$ Commented Nov 25, 2015 at 9:30
  • $\begingroup$ @JasonB Exactly ;) $\endgroup$ 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$ Commented Nov 25, 2015 at 9:32
  • $\begingroup$ @JasonB That sounds similar to using FrontEndExecute[ FrontEndToken[FrontEndTokenExecute["New"], "TileWindowsTall"]]. $\endgroup$ 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$ 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$ 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$ 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$ Commented Nov 25, 2015 at 11:11

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.