diff options
author | Lukas Mai <l.mai@web.de> | 2008-04-02 03:25:38 +0200 |
---|---|---|
committer | Lukas Mai <l.mai@web.de> | 2008-04-02 03:25:38 +0200 |
commit | 4126825a61896aa836ebc3b89a5a568e91172720 (patch) | |
tree | 927df242172f263653049a2cac5e3d6f554cd082 | |
parent | c619e54c3545f8750610939297fffb3d430bf09f (diff) | |
download | XMonadContrib-4126825a61896aa836ebc3b89a5a568e91172720.tar.gz XMonadContrib-4126825a61896aa836ebc3b89a5a568e91172720.tar.xz XMonadContrib-4126825a61896aa836ebc3b89a5a568e91172720.zip |
HintedGrid: try both bottom-up/top-down window placement to minimize unused space
darcs-hash:20080402012538-462cf-fb6e0b0de2f02167f068b6abc244c5523dbecb7d.gz
Diffstat (limited to '')
-rw-r--r-- | XMonad/Layout/HintedGrid.hs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/XMonad/Layout/HintedGrid.hs b/XMonad/Layout/HintedGrid.hs index 2031520..0e2b726 100644 --- a/XMonad/Layout/HintedGrid.hs +++ b/XMonad/Layout/HintedGrid.hs @@ -60,12 +60,17 @@ replicateS :: Int -> (a -> (b, a)) -> a -> ([b], a) replicateS n = runState . replicateM n . State doColumn :: Dimension -> Dimension -> Dimension -> [(D -> D)] -> [D] -doColumn width = doC +doColumn width height k adjs = + let + (h1, d1) = doC height k adjs + (h2, d2) = doC height k (reverse adjs) + in + if h2 < h1 then reverse d2 else d1 where - doC _ _ [] = [] - doC height n (f : fs) = adj : doC (height - h') (n - 1) fs + doC h _ [] = (h, []) + doC h n (f : fs) = (adj :) . doC (h - h') (n - 1) fs where - adj@(_, h') = f (width, height `div` n) + adj@(_, h') = f (width, h `div` n) doRect :: Dimension -> Dimension -> Dimension -> [[D -> D]] -> [Rectangle] doRect height = doR |