mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-08-10 17:52:09 -07:00
make some layouts more general.
This commit is contained in:
@@ -27,11 +27,11 @@ import Data.Ratio
|
|||||||
-- > import XMonadContrib.Accordion
|
-- > import XMonadContrib.Accordion
|
||||||
-- > defaultLayouts = [ accordion ]
|
-- > defaultLayouts = [ accordion ]
|
||||||
|
|
||||||
accordion :: Layout Window
|
accordion :: Eq a => Layout a
|
||||||
accordion = Layout { doLayout = accordionLayout
|
accordion = Layout { doLayout = accordionLayout
|
||||||
, modifyLayout = const $ return Nothing }
|
, modifyLayout = const $ return Nothing }
|
||||||
|
|
||||||
accordionLayout :: Rectangle -> W.Stack Window -> X [(Window, Rectangle)]
|
accordionLayout :: Eq a => Rectangle -> W.Stack a -> X [(a, Rectangle)]
|
||||||
accordionLayout sc ws = return $ (zip ups tops) ++
|
accordionLayout sc ws = return $ (zip ups tops) ++
|
||||||
[(W.focus ws, mainPane)] ++
|
[(W.focus ws, mainPane)] ++
|
||||||
(zip dns bottoms)
|
(zip dns bottoms)
|
||||||
|
@@ -27,11 +27,11 @@ import StackSet (integrate)
|
|||||||
--
|
--
|
||||||
-- > import XMonadContrib.Circle
|
-- > import XMonadContrib.Circle
|
||||||
|
|
||||||
circle :: Layout Window
|
circle :: Layout a
|
||||||
circle = Layout { doLayout = \r -> circleLayout r . integrate,
|
circle = Layout { doLayout = \r -> circleLayout r . integrate,
|
||||||
modifyLayout = return . const Nothing }
|
modifyLayout = return . const Nothing }
|
||||||
|
|
||||||
circleLayout :: Rectangle -> [Window] -> X [(Window, Rectangle)]
|
circleLayout :: Rectangle -> [a] -> X [(a, Rectangle)]
|
||||||
circleLayout _ [] = return []
|
circleLayout _ [] = return []
|
||||||
circleLayout r (w:ws) = return $ (w, center r) : (zip ws sats)
|
circleLayout r (w:ws) = return $ (w, center r) : (zip ws sats)
|
||||||
where sats = map (satellite r) $ take (length ws) [0, pi * 2 / fromIntegral (length ws) ..]
|
where sats = map (satellite r) $ take (length ws) [0, pi * 2 / fromIntegral (length ws) ..]
|
||||||
|
@@ -30,11 +30,11 @@ import StackSet
|
|||||||
-- > import XMonadContrib.Magnifier
|
-- > import XMonadContrib.Magnifier
|
||||||
-- > defaultLayouts = [ magnifier tiled , magnifier $ mirror tiled ]
|
-- > defaultLayouts = [ magnifier tiled , magnifier $ mirror tiled ]
|
||||||
|
|
||||||
magnifier :: Layout Window -> Layout Window
|
magnifier :: Eq a => Layout a -> Layout a
|
||||||
magnifier l = l { doLayout = \r s -> applyMagnifier r s `fmap` doLayout l r s
|
magnifier l = l { doLayout = \r s -> applyMagnifier r s `fmap` doLayout l r s
|
||||||
, modifyLayout = \x -> fmap magnifier `fmap` modifyLayout l x }
|
, modifyLayout = \x -> fmap magnifier `fmap` modifyLayout l x }
|
||||||
|
|
||||||
applyMagnifier :: Rectangle -> Stack Window -> [(Window, Rectangle)] -> [(Window, Rectangle)]
|
applyMagnifier :: Eq a => Rectangle -> Stack a -> [(a, Rectangle)] -> [(a, Rectangle)]
|
||||||
applyMagnifier r s | null (up s) = id -- don't change the master window
|
applyMagnifier r s | null (up s) = id -- don't change the master window
|
||||||
| otherwise = map $ \(w,wr) -> if w == focus s then (w, shrink r $ magnify wr) else (w, wr)
|
| otherwise = map $ \(w,wr) -> if w == focus s then (w, shrink r $ magnify wr) else (w, wr)
|
||||||
|
|
||||||
|
@@ -40,7 +40,7 @@ import StackSet ( integrate )
|
|||||||
-- > (mirror $ twoPane 0.03 0.85),1)] (twoPane 0.03 0.5) )
|
-- > (mirror $ twoPane 0.03 0.85),1)] (twoPane 0.03 0.5) )
|
||||||
|
|
||||||
|
|
||||||
square :: Layout Window
|
square :: Layout a
|
||||||
square = Layout { doLayout = \r s -> arrange r (integrate s), modifyLayout = message }
|
square = Layout { doLayout = \r s -> arrange r (integrate s), modifyLayout = message }
|
||||||
where
|
where
|
||||||
arrange rect ws@(_:_) = do
|
arrange rect ws@(_:_) = do
|
||||||
|
Reference in New Issue
Block a user