From 73c26465a6067c99aa4da7c5d94837d14dd736cd Mon Sep 17 00:00:00 2001 From: Peter De Wachter Date: Thu, 16 Aug 2007 18:52:17 +0000 Subject: [PATCH] fix MagicFocus/floats interaction --- MagicFocus.hs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/MagicFocus.hs b/MagicFocus.hs index cfe48b7a..2376cdd3 100644 --- a/MagicFocus.hs +++ b/MagicFocus.hs @@ -16,6 +16,7 @@ module XMonadContrib.MagicFocus ( -- $usage magicFocus) where +import Graphics.X11.Xlib (Window) import XMonad import StackSet @@ -23,9 +24,10 @@ import StackSet -- > import XMonadContrib.MagicFocus -- > defaultLayouts = [ magicFocus tiled , magicFocus $ mirror tiled ] -magicFocus :: Layout a -> Layout a -magicFocus l = l { doLayout = \s -> (doLayout l) s . swap +magicFocus :: Layout Window -> Layout Window +magicFocus l = l { doLayout = \r s -> withWindowSet (return . peek) >>= (doLayout l) r . swap s , modifyLayout = \x -> fmap magicFocus `fmap` modifyLayout l x } -swap :: Stack a -> Stack a -swap (Stack f u d) = Stack f [] (reverse u ++ d) +swap :: (Eq a) => Stack a -> Maybe a -> Stack a +swap (Stack f u d) focused | Just f == focused = Stack f [] (reverse u ++ d) + | otherwise = Stack f u d