From 7c7884a5d86cffaf306fde89d9d4d3a85d160d5c Mon Sep 17 00:00:00 2001 From: Andrea Rossato Date: Mon, 18 Feb 2008 14:13:20 +0100 Subject: add Eq superclass to DecorationStyle and change styles in order not to decorate non managed windows darcs-hash:20080218131320-32816-44ecfbd0dca9eb353a569898deefebef9f7088ed.gz --- XMonad/Layout/SimpleDecoration.hs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'XMonad/Layout/SimpleDecoration.hs') diff --git a/XMonad/Layout/SimpleDecoration.hs b/XMonad/Layout/SimpleDecoration.hs index 09527ed..aa5d500 100644 --- a/XMonad/Layout/SimpleDecoration.hs +++ b/XMonad/Layout/SimpleDecoration.hs @@ -53,16 +53,20 @@ import XMonad.Layout.Decoration -- > myL = dwmStyle shrinkText mySDConfig (layoutHook defaultTheme) -- | Add simple decorations to windows of a layout. -simpleDeco :: Shrinker s => s -> Theme +simpleDeco :: (Eq a, Shrinker s) => s -> Theme -> l a -> ModifiedLayout (Decoration SimpleDecoration s) l a simpleDeco s c = decoration s c $ Simple True data SimpleDecoration a = Simple Bool deriving (Show, Read) -instance DecorationStyle SimpleDecoration a where +instance Eq a => DecorationStyle SimpleDecoration a where describeDeco _ = "Simple" shrink (Simple b) (Rectangle _ _ _ dh) r@(Rectangle x y w h) = if b then Rectangle x (y + fi dh) w (h - dh) else r - pureDecoration (Simple b) wh ht _ _ _ (_,Rectangle x y wid _) = - if b then Just $ Rectangle x y nwh ht else Just $ Rectangle x (y - fi ht) nwh ht + pureDecoration (Simple b) wh ht _ s _ (w,Rectangle x y wid _) = + if isInStack s w + then if b + then Just $ Rectangle x y nwh ht + else Just $ Rectangle x (y - fi ht) nwh ht + else Nothing where nwh = min wid wh -- cgit v1.2.3