diff options
author | Andrea Rossato <andrea.rossato@unibz.it> | 2008-01-27 15:02:19 +0100 |
---|---|---|
committer | Andrea Rossato <andrea.rossato@unibz.it> | 2008-01-27 15:02:19 +0100 |
commit | abc827b6ff90cc4f4fc4b4831383203e6c7acee2 (patch) | |
tree | 6f373f595171b22c50d2f62e517af220254d29b3 | |
parent | 18dd26cb46d51d2d64626449de858962530f2a29 (diff) | |
download | XMonadContrib-abc827b6ff90cc4f4fc4b4831383203e6c7acee2.tar.gz XMonadContrib-abc827b6ff90cc4f4fc4b4831383203e6c7acee2.tar.xz XMonadContrib-abc827b6ff90cc4f4fc4b4831383203e6c7acee2.zip |
LayoutModifier add a modifyLayout
Many layouts are written as layout modifiers because they need to
change the stack of the rectangle before executing doLayout.
This is a major source of bugs. all layout modifiers should be using the
LayoutModifier class. This method (modifyLayout) can be used to
manipulate the rectangle and the stack before running doLayout by the
layout modifier.
darcs-hash:20080127140219-32816-bc3dbfc0be08587b94acead49f384e72c89e2df0.gz
-rw-r--r-- | XMonad/Layout/LayoutModifier.hs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/XMonad/Layout/LayoutModifier.hs b/XMonad/Layout/LayoutModifier.hs index 933b4e7..46cabd6 100644 --- a/XMonad/Layout/LayoutModifier.hs +++ b/XMonad/Layout/LayoutModifier.hs @@ -33,6 +33,9 @@ import XMonad.StackSet ( Stack ) -- "XMonad.Layout.Magnifier", "XMonad.Layout.NoBorder", class (Show (m a), Read (m a)) => LayoutModifier m a where + modifyLayout :: (LayoutClass l a) => m a -> l a -> Rectangle + -> Stack a -> X ([(a, Rectangle)], Maybe (l a)) + modifyLayout _ l r s = doLayout l r s handleMess :: m a -> SomeMessage -> X (Maybe (m a)) handleMess m mess | Just Hide <- fromMessage mess = doUnhook | Just ReleaseResources <- fromMessage mess = doUnhook @@ -61,7 +64,7 @@ class (Show (m a), Read (m a)) => LayoutModifier m a where instance (LayoutModifier m a, LayoutClass l a) => LayoutClass (ModifiedLayout m l) a where doLayout (ModifiedLayout m l) r s = - do (ws, ml') <- doLayout l r s + do (ws, ml') <- modifyLayout m l r s (ws', mm') <- redoLayout m r s ws let ml'' = case mm' of Just m' -> Just $ (ModifiedLayout m') $ maybe l id ml' |