aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad/Layout/LayoutModifier.hs
diff options
context:
space:
mode:
authorAndrea Rossato <andrea.rossato@unibz.it>2008-01-24 02:56:05 +0100
committerAndrea Rossato <andrea.rossato@unibz.it>2008-01-24 02:56:05 +0100
commit1dc2813cb5e01113c537d94f166eff1933d48e75 (patch)
tree8aa03b2418d3101a295aa0f82293479c3dd0992f /XMonad/Layout/LayoutModifier.hs
parent37656f4c9dd648d2801ab9a3dbcce9bce2239b29 (diff)
downloadXMonadContrib-1dc2813cb5e01113c537d94f166eff1933d48e75.tar.gz
XMonadContrib-1dc2813cb5e01113c537d94f166eff1933d48e75.tar.xz
XMonadContrib-1dc2813cb5e01113c537d94f166eff1933d48e75.zip
LayoutModifier: add emptyLayoutMod for dealing with empty workspaces
darcs-hash:20080124015605-32816-cdcd0b9509d793e85a2a0acd8d61e1ee69455568.gz
Diffstat (limited to 'XMonad/Layout/LayoutModifier.hs')
-rw-r--r--XMonad/Layout/LayoutModifier.hs10
1 files changed, 10 insertions, 0 deletions
diff --git a/XMonad/Layout/LayoutModifier.hs b/XMonad/Layout/LayoutModifier.hs
index 96772e4..933b4e7 100644
--- a/XMonad/Layout/LayoutModifier.hs
+++ b/XMonad/Layout/LayoutModifier.hs
@@ -49,6 +49,9 @@ class (Show (m a), Read (m a)) => LayoutModifier m a where
pureModifier :: m a -> Rectangle -> Stack a -> [(a, Rectangle)]
-> ([(a, Rectangle)], Maybe (m a))
pureModifier _ _ _ wrs = (wrs, Nothing)
+ emptyLayoutMod :: m a -> Rectangle -> [(a, Rectangle)]
+ -> X ([(a, Rectangle)], Maybe (m a))
+ emptyLayoutMod _ _ _ = return ([], Nothing)
hook :: m a -> X ()
hook _ = return ()
unhook :: m a -> X ()
@@ -64,6 +67,13 @@ instance (LayoutModifier m a, LayoutClass l a) => LayoutClass (ModifiedLayout m
Just m' -> Just $ (ModifiedLayout m') $ maybe l id ml'
Nothing -> ModifiedLayout m `fmap` ml'
return (ws', ml'')
+ emptyLayout (ModifiedLayout m l) r =
+ do (ws, ml') <- emptyLayout l r
+ (ws',mm') <- emptyLayoutMod m r ws
+ let ml'' = case mm' of
+ Just m' -> Just $ (ModifiedLayout m') $ maybe l id ml'
+ Nothing -> ModifiedLayout m `fmap` ml'
+ return (ws', ml'')
handleMessage (ModifiedLayout m l) mess =
do mm' <- handleMessOrMaybeModifyIt m mess
ml' <- case mm' of