2
$\begingroup$

I think someone has asked this in the past (maybe me), but I don't remember an answer or workaround.

When selecting Stack Windows from the menu bar e.g.

enter image description here

does any way exist to re-set the size of the resulting stacked windows?

As default sized they just take up too much desktop space:

enter image description here

I can't find anything obvious in Option Inspector.

Admittedly, just a little thing, but it would save me re-setting each stacked window one-by-one to regain desktop space.

While I've asked...specifying where the windows would stack would prove very useful.

$\endgroup$
2
  • $\begingroup$ My guess is that this is a macOS feature, not a Mathematica feature. $\endgroup$
    – Szabolcs
    Commented Jun 19, 2021 at 7:44
  • $\begingroup$ That's not a window option under 12.3 under Linux (and I don't remember it on Windows) $\endgroup$
    – mikado
    Commented Jun 19, 2021 at 10:33

1 Answer 1

4
$\begingroup$

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],

enter image description here

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
$\endgroup$
5
  • $\begingroup$ +1 for innovation. Unfortunately, I run on macOS which has everything in different files and folders. I found the entry for MenuItem[Stack Windows (windows: Stack)] & replaced it with your suggested code. Saved. Started Mma fresh. Didn't work. I likely missed something. Thoughts? Suggestions? $\endgroup$
    – Jagra
    Commented Jun 19, 2021 at 16:30
  • $\begingroup$ @Jagra Because the menu bar is language-dependent, are you sure you edit the default menusetup.tr, not those within Spanish or other languages folders? on Windows, there is a ...\Windows\menusetup.tr, ...\Windows\Spanish\menusetup.tr and 5 other languages, each with a menusetup.tr file. $\endgroup$
    – Ben Izd
    Commented Jun 19, 2021 at 17:17
  • $\begingroup$ Under macOS one finds this under the Mathematica.app -> FrontEnd -> TextResources -> Macintosh -> MenuSetup.tr, where one finds: MenuItem["Stack Windows", "StackWindows"]. Sees like the right thing. Thoughts? $\endgroup$
    – Jagra
    Commented Jun 19, 2021 at 17:56
  • $\begingroup$ @Jagra it seems you'd found the right file and the right line. I don't have access to a MacOS to test. but if you found the solution, feel free to edit the answer. $\endgroup$
    – Ben Izd
    Commented Jun 20, 2021 at 10:45
  • $\begingroup$ I may have, "...found the right file and the right line.", but it doesn't work ;-( Maybe someone else with a Mac will find an answer. Thanks for the effort. $\endgroup$
    – Jagra
    Commented Jun 20, 2021 at 21:12

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.