Basically, we'll manipulate Mathematica, so when you click Stack Windows
, the current WindowMargins
will be saved, and by clicking Restore Previous Arrangement
(which will be defined) we restore the positions.
Find file MenuSetup.tr
(Windows folder: Mathematica_directory\12.3\SystemFiles\FrontEnd\TextResources\Windows
), find for Stack Windows
(windows: Stack
) and replace it with these two MenuItem
MenuItem["Stack Windows", KernelExecute[CompoundExpression[FrontEnd`lastWindowMargins = AbsoluteCurrentValue[Notebooks[], WindowMargins], FrontEnd`lastWindowSize = AbsoluteCurrentValue[Notebooks[], WindowSize], FrontEndTokenExecute["StackWindows"]]],MenuEvaluator -> Automatic],
MenuItem["Restore Previous Arrangement",KernelExecute[MapThread[(CurrentValue[#1, WindowMargins] = #2; CurrentValue[#1, WindowSize] = #3) &, {Notebooks[], FrontEnd`lastWindowMargins, FrontEnd`lastWindowSize}]],MenuEvaluator -> Automatic],
Notes:
- Tested on Windows 10 with Mathematica 12.3
- Do not click
Restore Previous Arrangement
without clicking Stack Windows
first (it won't crash, Messages
pops up)
- Also don't create/open or close a file after clicking
Stack Windows
, if you want to click Restore Previous Arrangement
- First time clicking
Stack
will be a bit slower