I don't know of any way to do this natively, aside from Mission Control.
Hammerspoon is a low-level automation tool which is great for this type of thing, if a little clumsy. It exposes many OS-level operations to a Lua scripting engine, including positioning of windows, among very many other things.
To implement this functionality in Hammerspoon, you could do something like:
function cascadeWindows()
local windows = hs.window.allWindows()
local screen = windows[1]:screen():frame()
local xMargin, yMargin = screen.w/5, screen.h/5 -- This is equal to the gap between the edge of the topleft window and the edge of the screen.
local layout = {}
for i, win in ipairs(windows) do
local winPos = {
win:application(),
win:title(),
win:screen(),
nil, hs.geometry.rect(
(i-1)*(xMargin/(#windows-1)), -- x
(i-1)*(yMargin/(#windows-1)), -- y, you might end up having to add some number here
screen.w - xMargin, -- w
screen.h - yMargin -- h
), nil
}
layout[#layout+1] = winPos
end
hs.layout.apply(layout)
end
hs.hotkey.bind({'cmd','alt','ctrl'}, 'space', cascadeWindows)
This code has been loosely tested, but should work as a starting point. To install, first install Hammerspoon, then put this code into your ~/.hammerspoon/init.lua
file. You can find more information on exactly what is happening up there in the documentation for hs.layout.apply
, and more generally in the Hammerspoon documentary.
If you don't know Lua and don't want to learn Lua (It's quick and easy!), or don't want to get involved in learning a new tool as deep as Hammerspoon, you can just follow the above instructions changing the key binding to whatever you want.
Thanks for this, it's a great start. Just tried this out, put error message above. – ThomasReggi – 2016-03-04T19:04:35.407