(this is related to my other question, see here)
I would like to write a function that scores a given arrangement of windows on a screen.
The purpose of this function is to determine whether a particular layout is good and by going over other possible layouts, finding the one with the highest score.
Here are some characteristics that I think make a good layout:
- maximizing amount of space used by windows (or in other words, the free space on the screen should be minimized)
- windows are (more or less) evenly sized
Bonus: assigning each window a priority and giving a higher score for layouts where windows with a higher priority take more space.
Here's an example: Suppose our screen is 11x11 and we want to put two windows on it. Window A's initial size is 1x1 and window B is 2x1.
When we resize windows, we preserve their aspect ratio. So here are two possible layout:
The function should give the one on the right a higher score.
Another nice thing to have is the option to 'dock' a window to one or more sides of the screen. Then suppose we want to dock A to the bottom-left of the screen, the scoring function should prefer this layout than the above one on the right: