mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-08-01 12:41:52 -07:00
XMonad.Layout.Grid: fix indentation
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
module XMonad.Layout.Grid (
|
||||
-- * Usage
|
||||
-- $usage
|
||||
Grid(..), arrange
|
||||
Grid(..), arrange
|
||||
) where
|
||||
|
||||
import XMonad
|
||||
@@ -44,23 +44,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
|
||||
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]
|
||||
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]
|
||||
|
Reference in New Issue
Block a user