aboutsummaryrefslogtreecommitdiffstats
path: root/Square.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Square.hs')
-rw-r--r--Square.hs17
1 files changed, 9 insertions, 8 deletions
diff --git a/Square.hs b/Square.hs
index 02a5adb..c4c0a05 100644
--- a/Square.hs
+++ b/Square.hs
@@ -20,11 +20,11 @@
module XMonadContrib.Square (
-- * Usage
-- $usage
- square ) where
+ Square(..) ) where
import XMonad
import Graphics.X11.Xlib
-import XMonadContrib.LayoutHelpers ( l2lModDo, idModify )
+import StackSet ( integrate )
-- $usage
-- You can use this module with the following in your Config.hs file:
@@ -40,12 +40,13 @@ import XMonadContrib.LayoutHelpers ( l2lModDo, idModify )
-- %import XMonadContrib.Square
-square :: Layout a
-square = Layout { doLayout = l2lModDo arrange, modifyLayout = idModify }
- where arrange :: Rectangle -> [a] -> [(a, Rectangle)]
- arrange rect ws@(_:_) = map (\w->(w,rest)) (init ws) ++ [(last ws,sq)]
- where (rest, sq) = splitSquare rect
- arrange _ [] = []
+data Square a = Square deriving ( Read, Show )
+
+instance Layout Square a where
+ pureLayout Square r s = arrange (integrate s)
+ where arrange ws@(_:_) = map (\w->(w,rest)) (init ws) ++ [(last ws,sq)]
+ arrange [] = [] -- actually, this is an impossible case
+ (rest, sq) = splitSquare r
splitSquare :: Rectangle -> (Rectangle, Rectangle)
splitSquare (Rectangle x y w h)