aboutsummaryrefslogtreecommitdiffstats
path: root/XMonad/Layout/ThreeColumns.hs
diff options
context:
space:
mode:
authorAdam Vogt <vogt.adam@gmail.com>2009-04-14 08:18:19 +0200
committerAdam Vogt <vogt.adam@gmail.com>2009-04-14 08:18:19 +0200
commit09d42195c82112f658fb388a0151e7d0b0403ef5 (patch)
treeef3f2ae88a6e52b9f9958a599de5afcf8745d20e /XMonad/Layout/ThreeColumns.hs
parentf54eb78c74573c9b8499032eeb8334e354fdfe0c (diff)
downloadXMonadContrib-09d42195c82112f658fb388a0151e7d0b0403ef5.tar.gz
XMonadContrib-09d42195c82112f658fb388a0151e7d0b0403ef5.tar.xz
XMonadContrib-09d42195c82112f658fb388a0151e7d0b0403ef5.zip
ThreeColumns support middle column, with more backwards compatiblity
Ignore-this: 5a8991269904986e0e012e955c6d4712 darcs-hash:20090414061819-1499c-fe2d526b41d0224f363e586c392d93f60584b51c.gz
Diffstat (limited to 'XMonad/Layout/ThreeColumns.hs')
-rw-r--r--XMonad/Layout/ThreeColumns.hs28
1 files changed, 18 insertions, 10 deletions
diff --git a/XMonad/Layout/ThreeColumns.hs b/XMonad/Layout/ThreeColumns.hs
index 06eb943..fe203be 100644
--- a/XMonad/Layout/ThreeColumns.hs
+++ b/XMonad/Layout/ThreeColumns.hs
@@ -5,7 +5,7 @@
-- Module : XMonad.Layout.ThreeColumns
-- Copyright : (c) Kai Grossjohann <kai@emptydomain.de>
-- License : BSD3-style (see LICENSE)
---
+--
-- Maintainer : ?
-- Stability : unstable
-- Portability : unportable
@@ -38,7 +38,7 @@ import Control.Monad
--
-- Then edit your @layoutHook@ by adding the ThreeCol layout:
--
--- > myLayouts = ThreeCol False 1 (3/100) (1/2) ||| etc..
+-- > myLayouts = ThreeCol 1 (3/100) (1/2) ||| etc..
-- > main = xmonad defaultConfig { layoutHook = myLayouts }
--
-- If the first argument is true, the main window is placed in the center
@@ -54,20 +54,28 @@ import Control.Monad
--
-- "XMonad.Doc.Extending#Editing_the_layout_hook"
-data ThreeCol a = ThreeCol !Bool !Int !Rational !Rational deriving (Show,Read)
+-- | Arguments are nmaster, delta, fraction
+data ThreeCol a = ThreeColMid { threeColNMaster :: !Int, threeColDelta :: !Rational, threeColFrac :: !Rational}
+ | ThreeCol { threeColNMaster :: !Int, threeColDelta :: !Rational, threeColFrac :: !Rational}
+ deriving (Show,Read)
instance LayoutClass ThreeCol a where
- doLayout (ThreeCol middle nmaster _ frac) r =
- return . (\x->(x,Nothing)) .
- ap zip (tile3 middle frac r nmaster . length) . W.integrate
- handleMessage (ThreeCol middle nmaster delta frac) m =
+ pureLayout (ThreeCol n _ f) r = doL False n f r
+ pureLayout (ThreeColMid n _ f) r = doL True n f r
+ handleMessage l m =
return $ msum [fmap resize (fromMessage m)
,fmap incmastern (fromMessage m)]
- where resize Shrink = ThreeCol middle nmaster delta (max (-0.5) $ frac-delta)
- resize Expand = ThreeCol middle nmaster delta (min 1 $ frac+delta)
- incmastern (IncMasterN d) = ThreeCol middle (max 0 (nmaster+d)) delta frac
+ where resize Shrink = l { threeColFrac = max (-0.5) $ f-d }
+ resize Expand = l { threeColFrac = min 1 $ f+d }
+ incmastern (IncMasterN x) = l { threeColNMaster = max 0 (n+x) }
+ n = threeColNMaster l
+ d = threeColDelta l
+ f = threeColFrac l
description _ = "ThreeCol"
+doL :: Bool-> Int-> Rational-> Rectangle-> W.Stack a-> [(a, Rectangle)]
+doL m n f r = ap zip (tile3 m f r n . length) . W.integrate
+
-- | tile3. Compute window positions using 3 panes
tile3 :: Bool -> Rational -> Rectangle -> Int -> Int -> [Rectangle]
tile3 middle f r nmaster n