diff options
author | David Roundy <droundy@darcs.net> | 2007-06-22 16:29:50 +0200 |
---|---|---|
committer | David Roundy <droundy@darcs.net> | 2007-06-22 16:29:50 +0200 |
commit | 060583dd3919eeeb565123c4f2ff7cbd2c999288 (patch) | |
tree | 25b1be9c8f13fc4e54931b45bf607e500f0dc89d /Square.hs | |
parent | 1c0dbc793902f65ddb43f7a4e527c333d745e388 (diff) | |
download | XMonadContrib-060583dd3919eeeb565123c4f2ff7cbd2c999288.tar.gz XMonadContrib-060583dd3919eeeb565123c4f2ff7cbd2c999288.tar.xz XMonadContrib-060583dd3919eeeb565123c4f2ff7cbd2c999288.zip |
add new LayoutHelpers module.
darcs-hash:20070622142950-72aca-6dc011f903d12a056b1124752fc37f23368f898e.gz
Diffstat (limited to 'Square.hs')
-rw-r--r-- | Square.hs | 23 |
1 files changed, 10 insertions, 13 deletions
@@ -22,14 +22,10 @@ module XMonadContrib.Square ( -- $usage square ) where -import XMonad -import Graphics.X11.Xlib -import StackSet ( integrate ) - -- $usage -- You can use this module with the following in your Config.hs file: -- --- > import XMonadContrib.Spiral +-- > import XMonadContrib.Square -- -- An example layout using square together with "XMonadContrib.Combo" -- to make the very last area square: @@ -39,16 +35,17 @@ import StackSet ( integrate ) -- > ,(combo [(twoPane 0.03 0.8,1),(square,1)] -- > (mirror $ twoPane 0.03 0.85),1)] (twoPane 0.03 0.5) ) +import XMonad +import Graphics.X11.Xlib +import StackSet ( integrate ) +import XMonadContrib.LayoutHelpers ( l2lModDo ) square :: Layout a -square = Layout { doLayout = \r s -> arrange r (integrate s), modifyLayout = message } - where - arrange rect ws@(_:_) = do - let (rest, sq) = splitSquare rect - return (map (\w->(w,rest)) (init ws) ++ [(last ws,sq)]) - arrange _ [] = return [] - - message _ = return Nothing +square = Layout { doLayout = l2lModDo arrange, modifyLayout = const (return Nothing) } + where arrange :: Rectangle -> [a] -> [(a, Rectangle)] + arrange rect ws@(_:_) = map (\w->(w,rest)) (init ws) ++ [(last ws,sq)] + where (rest, sq) = splitSquare rect + arrange _ [] = [] splitSquare :: Rectangle -> (Rectangle, Rectangle) splitSquare (Rectangle x y w h) |