From 751e083f7eceb7ab5c95b42666efa8f45d0672af Mon Sep 17 00:00:00 2001 From: Andrea Rossato Date: Sun, 27 Jan 2008 17:58:54 +0100 Subject: Reflect: reimplemented as a layout modifier (which makes it compatible with windowArranger and decoration) darcs-hash:20080127165854-32816-682cd6eac087a6a394389aa3ca7566626c7aaa32.gz --- XMonad/Layout/Reflect.hs | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) (limited to 'XMonad/Layout/Reflect.hs') diff --git a/XMonad/Layout/Reflect.hs b/XMonad/Layout/Reflect.hs index 29a205c..7147de2 100644 --- a/XMonad/Layout/Reflect.hs +++ b/XMonad/Layout/Reflect.hs @@ -28,9 +28,9 @@ module XMonad.Layout.Reflect ( import XMonad.Core import Graphics.X11 (Rectangle(..), Window) -import Control.Arrow ((***), second) -import Control.Applicative ((<$>)) +import Control.Arrow (second) +import XMonad.Layout.LayoutModifier import XMonad.Layout.MultiToggle -- $usage @@ -68,13 +68,13 @@ import XMonad.Layout.MultiToggle -- | Apply a horizontal reflection (left \<--\> right) to a -- layout. -reflectHoriz :: (LayoutClass l a) => (l a) -> Reflect l a -reflectHoriz = Reflect Horiz +reflectHoriz :: l a -> ModifiedLayout Reflect l a +reflectHoriz = ModifiedLayout (Reflect Horiz) -- | Apply a vertical reflection (top \<--\> bottom) to a -- layout. -reflectVert :: (LayoutClass l a) => (l a) -> Reflect l a -reflectVert = Reflect Vert +reflectVert :: l a -> ModifiedLayout Reflect l a +reflectVert = ModifiedLayout (Reflect Vert) data ReflectDir = Horiz | Vert deriving (Read, Show) @@ -92,18 +92,14 @@ fi :: (Integral a, Num b) => a -> b fi = fromIntegral -data Reflect l a = Reflect ReflectDir (l a) deriving (Show, Read) +data Reflect a = Reflect ReflectDir deriving (Show, Read) -instance LayoutClass l a => LayoutClass (Reflect l) a where +instance LayoutModifier Reflect a where - -- do layout l, then reflect all the generated Rectangles. - doLayout (Reflect d l) r s = (map (second (reflectRect d r)) *** fmap (Reflect d)) - <$> doLayout l r s + -- reflect all the generated Rectangles. + pureModifier (Reflect d) r _ wrs = (map (second $ reflectRect d r) wrs, Just $ Reflect d) - -- pass messages on to the underlying layout - handleMessage (Reflect d l) = fmap (fmap (Reflect d)) . handleMessage l - - description (Reflect d l) = "Reflect" ++ xy ++ " " ++ description l + modifierDescription (Reflect d) = "Reflect" ++ xy where xy = case d of { Horiz -> "X" ; Vert -> "Y" } -- cgit v1.2.3