summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Roundy <droundy@darcs.net>2007-06-19 17:08:16 +0200
committerDavid Roundy <droundy@darcs.net>2007-06-19 17:08:16 +0200
commit89d4a3d97510872051524cd7078db2d33c4e7b3f (patch)
tree902858067505fd119d9b67d32d61f3db93656334
parent9081664484b98066eb793ae5ab14f350ace89dd5 (diff)
downloadmetatile-89d4a3d97510872051524cd7078db2d33c4e7b3f.tar
metatile-89d4a3d97510872051524cd7078db2d33c4e7b3f.zip
make Layouts able to layout whatever they like.
darcs-hash:20070619150816-72aca-a651e758e93e300c3e526985b328f0b1d7def60c
-rw-r--r--Config.hs2
-rw-r--r--Operations.hs6
-rw-r--r--XMonad.hs8
3 files changed, 8 insertions, 8 deletions
diff --git a/Config.hs b/Config.hs
index 6bd2042..655d654 100644
--- a/Config.hs
+++ b/Config.hs
@@ -84,7 +84,7 @@ borderWidth = 1
-- |
-- The default set of tiling algorithms
--
-defaultLayouts :: [Layout]
+defaultLayouts :: [Layout Window]
defaultLayouts = [ tiled , mirror tiled , full ]
where
-- default tiling algorithm partitions the screen into two panes
diff --git a/Operations.hs b/Operations.hs
index 6d54c7c..4eaf3e2 100644
--- a/Operations.hs
+++ b/Operations.hs
@@ -368,14 +368,14 @@ instance Message IncMasterN
-- simple fullscreen mode, just render all windows fullscreen.
-- a plea for tuple sections: map . (,sc)
-full :: Layout
+full :: Layout a
full = Layout { doLayout = \sc (W.Stack f _ _) -> return [(f, sc)]
, modifyLayout = const (return Nothing) } -- no changes
--
-- The tiling mode of xmonad, and its operations.
--
-tall :: Int -> Rational -> Rational -> Layout
+tall :: Int -> Rational -> Rational -> Layout a
tall nmaster delta frac =
Layout { doLayout = \r -> return . ap zip (tile frac r nmaster . length) . W.integrate
, modifyLayout = \m -> return $ msum [fmap resize (fromMessage m)
@@ -390,7 +390,7 @@ mirrorRect :: Rectangle -> Rectangle
mirrorRect (Rectangle rx ry rw rh) = (Rectangle ry rx rh rw)
-- | Mirror a layout, compute its 90 degree rotated form.
-mirror :: Layout -> Layout
+mirror :: Layout a -> Layout a
mirror (Layout { doLayout = dl, modifyLayout = ml }) =
Layout { doLayout = \sc w -> map (second mirrorRect) `fmap` dl (mirrorRect sc) w
, modifyLayout = fmap (fmap mirror) . ml }
diff --git a/XMonad.hs b/XMonad.hs
index 46ef260..b6e9f91 100644
--- a/XMonad.hs
+++ b/XMonad.hs
@@ -43,7 +43,7 @@ data XState = XState
, statusGaps :: ![(Int,Int,Int,Int)] -- ^ width of status bar on each screen
, mapped :: !(S.Set Window) -- ^ the Set of mapped windows
, waitingUnmap :: !(M.Map Window Int) -- ^ the number of expected UnmapEvents
- , layouts :: !(M.Map WorkspaceId (Layout, [Layout])) }
+ , layouts :: !(M.Map WorkspaceId (Layout Window, [Layout Window])) }
-- ^ mapping of workspaces to descriptions of their layouts
data XConf = XConf
{ display :: Display -- ^ the X11 display
@@ -119,10 +119,10 @@ atom_WM_STATE = getAtom "WM_STATE"
-- 'doLayout', a pure function to layout a Window set 'modifyLayout',
-- 'modifyLayout' can be considered a branch of an exception handler.
--
-data Layout = Layout { doLayout :: Rectangle -> Stack Window -> X [(Window, Rectangle)]
- , modifyLayout :: SomeMessage -> X (Maybe Layout) }
+data Layout a = Layout { doLayout :: Rectangle -> Stack a -> X [(a, Rectangle)]
+ , modifyLayout :: SomeMessage -> X (Maybe (Layout a)) }
-runLayout :: Layout -> Rectangle -> StackOrNot Window -> X [(Window, Rectangle)]
+runLayout :: Layout a -> Rectangle -> StackOrNot a -> X [(a, Rectangle)]
runLayout l r = maybe (return []) (doLayout l r)
-- | Based on ideas in /An Extensible Dynamically-Typed Hierarchy of Exceptions/,