Grid/HintedGrid: use an ncolumns formula inspired by dwm's "optimal" mode

This commit is contained in:
Lukas Mai
2008-04-02 01:21:26 +00:00
parent 25c23eb79d
commit d2df9b329e
2 changed files with 2 additions and 5 deletions

View File

@@ -46,7 +46,7 @@ arrange :: Rectangle -> [a] -> [(a, Rectangle)]
arrange (Rectangle rx ry rw rh) st = zip st rectangles
where
nwins = length st
ncols = ceiling . (sqrt :: Double -> Double) . fromIntegral $ nwins
ncols = max 1 . round . sqrt $ fromIntegral nwins * fromIntegral rw / (fromIntegral rh :: Double)
mincs = nwins `div` ncols
extrs = nwins - ncols * mincs
chop :: Int -> Dimension -> [(Position, Dimension)]