aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad/Layout/Reflect.hs
diff options
context:
space:
mode:
authorAndrea Rossato <andrea.rossato@unibz.it>2008-01-27 17:58:54 +0100
committerAndrea Rossato <andrea.rossato@unibz.it>2008-01-27 17:58:54 +0100
commit751e083f7eceb7ab5c95b42666efa8f45d0672af (patch)
treef5a7ee4ca7cfe6dc8567674b14ff393bcb069993 /XMonad/Layout/Reflect.hs
parent1a127ac1dbd7f8fc3b55e1ee31740c66e38fcfd8 (diff)
downloadXMonadContrib-751e083f7eceb7ab5c95b42666efa8f45d0672af.tar.gz
XMonadContrib-751e083f7eceb7ab5c95b42666efa8f45d0672af.tar.xz
XMonadContrib-751e083f7eceb7ab5c95b42666efa8f45d0672af.zip
Reflect: reimplemented as a layout modifier (which makes it compatible with windowArranger and decoration)
darcs-hash:20080127165854-32816-682cd6eac087a6a394389aa3ca7566626c7aaa32.gz
Diffstat (limited to 'XMonad/Layout/Reflect.hs')
-rw-r--r--XMonad/Layout/Reflect.hs26
1 files changed, 11 insertions, 15 deletions
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" }