mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 11:30:22 -07:00
Reflect: reimplemented as a layout modifier (which makes it compatible with windowArranger and decoration)
This commit is contained in:
parent
ddbbc56285
commit
c281e20e0a
@ -28,9 +28,9 @@ module XMonad.Layout.Reflect (
|
|||||||
|
|
||||||
import XMonad.Core
|
import XMonad.Core
|
||||||
import Graphics.X11 (Rectangle(..), Window)
|
import Graphics.X11 (Rectangle(..), Window)
|
||||||
import Control.Arrow ((***), second)
|
import Control.Arrow (second)
|
||||||
import Control.Applicative ((<$>))
|
|
||||||
|
|
||||||
|
import XMonad.Layout.LayoutModifier
|
||||||
import XMonad.Layout.MultiToggle
|
import XMonad.Layout.MultiToggle
|
||||||
|
|
||||||
-- $usage
|
-- $usage
|
||||||
@ -68,13 +68,13 @@ import XMonad.Layout.MultiToggle
|
|||||||
|
|
||||||
-- | Apply a horizontal reflection (left \<--\> right) to a
|
-- | Apply a horizontal reflection (left \<--\> right) to a
|
||||||
-- layout.
|
-- layout.
|
||||||
reflectHoriz :: (LayoutClass l a) => (l a) -> Reflect l a
|
reflectHoriz :: l a -> ModifiedLayout Reflect l a
|
||||||
reflectHoriz = Reflect Horiz
|
reflectHoriz = ModifiedLayout (Reflect Horiz)
|
||||||
|
|
||||||
-- | Apply a vertical reflection (top \<--\> bottom) to a
|
-- | Apply a vertical reflection (top \<--\> bottom) to a
|
||||||
-- layout.
|
-- layout.
|
||||||
reflectVert :: (LayoutClass l a) => (l a) -> Reflect l a
|
reflectVert :: l a -> ModifiedLayout Reflect l a
|
||||||
reflectVert = Reflect Vert
|
reflectVert = ModifiedLayout (Reflect Vert)
|
||||||
|
|
||||||
data ReflectDir = Horiz | Vert
|
data ReflectDir = Horiz | Vert
|
||||||
deriving (Read, Show)
|
deriving (Read, Show)
|
||||||
@ -92,18 +92,14 @@ fi :: (Integral a, Num b) => a -> b
|
|||||||
fi = fromIntegral
|
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.
|
-- reflect all the generated Rectangles.
|
||||||
doLayout (Reflect d l) r s = (map (second (reflectRect d r)) *** fmap (Reflect d))
|
pureModifier (Reflect d) r _ wrs = (map (second $ reflectRect d r) wrs, Just $ Reflect d)
|
||||||
<$> doLayout l r s
|
|
||||||
|
|
||||||
-- pass messages on to the underlying layout
|
modifierDescription (Reflect d) = "Reflect" ++ xy
|
||||||
handleMessage (Reflect d l) = fmap (fmap (Reflect d)) . handleMessage l
|
|
||||||
|
|
||||||
description (Reflect d l) = "Reflect" ++ xy ++ " " ++ description l
|
|
||||||
where xy = case d of { Horiz -> "X" ; Vert -> "Y" }
|
where xy = case d of { Horiz -> "X" ; Vert -> "Y" }
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user