diff options
author | Devin Mullins <me@twifkak.com> | 2007-11-17 21:11:40 +0100 |
---|---|---|
committer | Devin Mullins <me@twifkak.com> | 2007-11-17 21:11:40 +0100 |
commit | 6e1c69d89abbba19b6d7df99e34ff5f2a2771075 (patch) | |
tree | 30ff965969f7711eda1264480a09b8ba15dc1ad7 /XMonad/Layout | |
parent | bc0cb7bc378f4b84936872a6e1bbdff130390293 (diff) | |
download | XMonadContrib-6e1c69d89abbba19b6d7df99e34ff5f2a2771075.tar.gz XMonadContrib-6e1c69d89abbba19b6d7df99e34ff5f2a2771075.tar.xz XMonadContrib-6e1c69d89abbba19b6d7df99e34ff5f2a2771075.zip |
Grid: tabs -> spaces
darcs-hash:20071117201140-78224-c421f639531d6268800afd3cd476b9efc2fc567e.gz
Diffstat (limited to 'XMonad/Layout')
-rw-r--r-- | XMonad/Layout/Grid.hs | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/XMonad/Layout/Grid.hs b/XMonad/Layout/Grid.hs index b10a8ac..f7454e4 100644 --- a/XMonad/Layout/Grid.hs +++ b/XMonad/Layout/Grid.hs @@ -43,23 +43,23 @@ instance LayoutClass Grid a where 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 - mincs = nwins `div` ncols - extrs = nwins - ncols * mincs - chop :: Int -> Dimension -> [(Position, Dimension)] - chop n m = ((0, m - k * fromIntegral (pred n)) :) . map (flip (,) k) . tail . reverse . take n . tail . iterate (subtract k') $ m' - where - k :: Dimension - k = m `div` fromIntegral n - m' = fromIntegral m - k' :: Position - k' = fromIntegral k - xcoords = chop ncols rw - ycoords = chop mincs rh - ycoords' = chop (succ mincs) rh - (xbase, xext) = splitAt (ncols - extrs) xcoords - rectangles = combine ycoords xbase ++ combine ycoords' xext - where - combine ys xs = [Rectangle (rx + x) (ry + y) w h | (x, w) <- xs, (y, h) <- ys] + where + nwins = length st + ncols = ceiling . (sqrt :: Double -> Double) . fromIntegral $ nwins + mincs = nwins `div` ncols + extrs = nwins - ncols * mincs + chop :: Int -> Dimension -> [(Position, Dimension)] + chop n m = ((0, m - k * fromIntegral (pred n)) :) . map (flip (,) k) . tail . reverse . take n . tail . iterate (subtract k') $ m' + where + k :: Dimension + k = m `div` fromIntegral n + m' = fromIntegral m + k' :: Position + k' = fromIntegral k + xcoords = chop ncols rw + ycoords = chop mincs rh + ycoords' = chop (succ mincs) rh + (xbase, xext) = splitAt (ncols - extrs) xcoords + rectangles = combine ycoords xbase ++ combine ycoords' xext + where + combine ys xs = [Rectangle (rx + x) (ry + y) w h | (x, w) <- xs, (y, h) <- ys] |