From 1dc2813cb5e01113c537d94f166eff1933d48e75 Mon Sep 17 00:00:00 2001 From: Andrea Rossato Date: Thu, 24 Jan 2008 02:56:05 +0100 Subject: LayoutModifier: add emptyLayoutMod for dealing with empty workspaces darcs-hash:20080124015605-32816-cdcd0b9509d793e85a2a0acd8d61e1ee69455568.gz --- XMonad/Layout/LayoutModifier.hs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'XMonad/Layout/LayoutModifier.hs') 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 -- cgit v1.2.3