aboutsummaryrefslogtreecommitdiffstats
path: root/LayoutHelpers.hs
diff options
context:
space:
mode:
authorDavid Roundy <droundy@darcs.net>2007-09-23 23:59:56 +0200
committerDavid Roundy <droundy@darcs.net>2007-09-23 23:59:56 +0200
commitc97e1e27f90b2c05bf4fdffe877a7f29fd227da3 (patch)
treecb442dfa9d449d629726f934a191fdfdf9bbac0d /LayoutHelpers.hs
parente10ef71da054c12355f720344d4c4ca0c11b4e12 (diff)
downloadXMonadContrib-c97e1e27f90b2c05bf4fdffe877a7f29fd227da3.tar.gz
XMonadContrib-c97e1e27f90b2c05bf4fdffe877a7f29fd227da3.tar.xz
XMonadContrib-c97e1e27f90b2c05bf4fdffe877a7f29fd227da3.zip
rename LayoutHelpers to LayoutModifier.
darcs-hash:20070923215956-72aca-af065b4b5a9aaf57adca7eb93aa72ae843656cd1.gz
Diffstat (limited to 'LayoutHelpers.hs')
-rw-r--r--LayoutHelpers.hs55
1 files changed, 0 insertions, 55 deletions
diff --git a/LayoutHelpers.hs b/LayoutHelpers.hs
deleted file mode 100644
index ed7a0f1..0000000
--- a/LayoutHelpers.hs
+++ /dev/null
@@ -1,55 +0,0 @@
------------------------------------------------------------------------------
--- |
--- Module : XMonadContrib.LayoutHelpers
--- Copyright : (c) David Roundy <droundy@darcs.net>
--- License : BSD
---
--- Maintainer : David Roundy <droundy@darcs.net>
--- Stability : unstable
--- Portability : portable
---
--- A module for writing easy Layouts
------------------------------------------------------------------------------
-
-module XMonadContrib.LayoutHelpers (
- -- * Usage
- -- $usage
- LayoutModifier(..), ModifiedLayout(..)
- ) where
-
-import Graphics.X11.Xlib ( Rectangle )
-import XMonad
-import StackSet ( Stack )
-import Operations ( UnDoLayout(UnDoLayout) )
-
--- $usage
--- Use LayoutHelpers to help write easy Layouts.
-
-class (Show (m a), Read (m a)) => LayoutModifier m a where
- modifyModify :: m a -> SomeMessage -> X (Maybe (m l))
- modifyModify m mess | Just UnDoLayout <- fromMessage mess = do unhook m; return Nothing
- | otherwise = return Nothing
- redoLayout :: m a -> Rectangle -> Stack a -> [(a, Rectangle)]
- -> X ([(a, Rectangle)], Maybe (m l))
- redoLayout m _ _ wrs = do hook m; return (wrs, Nothing)
- hook :: m a -> X ()
- hook _ = return ()
- unhook :: m a -> X ()
- unhook _ = return ()
-
-instance (LayoutModifier m a, Layout l a) => Layout (ModifiedLayout m l) a where
- doLayout (ModifiedLayout m l) r s =
- do (ws, ml') <- doLayout l r s
- (ws', mm') <- redoLayout m r s ws
- let ml'' = case mm' of
- Just m' -> Just $ (ModifiedLayout m') $ maybe l id ml'
- Nothing -> ModifiedLayout m `fmap` ml'
- return (ws', ml'')
- modifyLayout (ModifiedLayout m l) mess =
- do ml' <- modifyLayout l mess
- mm' <- modifyModify m mess
- return $ case mm' of
- Just m' -> Just $ (ModifiedLayout m') $ maybe l id ml'
- Nothing -> (ModifiedLayout m) `fmap` ml'
-
-data ModifiedLayout m l a = ModifiedLayout (m a) (l a) deriving ( Read, Show )