aboutsummaryrefslogtreecommitdiffstats
path: root/ThreeColumns.hs
diff options
context:
space:
mode:
authorKai Grossjohann <kai@emptydomain.de>2007-07-21 17:08:25 +0200
committerKai Grossjohann <kai@emptydomain.de>2007-07-21 17:08:25 +0200
commit0ad5b3a5be07a6dcae53367c401080a379e5c3b1 (patch)
treeba8c810b677f607504856138fa3d03f0967b358d /ThreeColumns.hs
parent97b136fcde7597c5ae6c81e405d46cd70d1358ae (diff)
downloadXMonadContrib-0ad5b3a5be07a6dcae53367c401080a379e5c3b1.tar.gz
XMonadContrib-0ad5b3a5be07a6dcae53367c401080a379e5c3b1.tar.xz
XMonadContrib-0ad5b3a5be07a6dcae53367c401080a379e5c3b1.zip
fix 3col layout for nmaster + 1 windows
Do like two column layout if there are nmaster+1 windows (putting 1 window in the right column). darcs-hash:20070721150825-07ca0-93b9747e62c1707a2dfac33bc0a5af966c6ae534.gz
Diffstat (limited to 'ThreeColumns.hs')
-rw-r--r--ThreeColumns.hs10
1 files changed, 6 insertions, 4 deletions
diff --git a/ThreeColumns.hs b/ThreeColumns.hs
index 6d74cb9..c8edc5f 100644
--- a/ThreeColumns.hs
+++ b/ThreeColumns.hs
@@ -20,7 +20,7 @@ module XMonadContrib.ThreeColumns (
import XMonad
import qualified StackSet as W
-import Operations ( Resize(..), IncMasterN(..), splitVertically, tall )
+import Operations ( Resize(..), IncMasterN(..), splitVertically, tall, splitHorizontallyBy )
import Data.Ratio
@@ -52,10 +52,12 @@ threeCol nmaster delta frac =
-- | tile3. Compute window positions using 3 panes
tile3 :: Rational -> Rectangle -> Int -> Int -> [Rectangle]
-tile3 f r nmaster n = if n <= nmaster || nmaster == 0
- then splitVertically n r
- else splitVertically nmaster r1 ++ splitVertically nmid r2 ++ splitVertically nright r3
+tile3 f r nmaster n
+ | n <= nmaster || nmaster == 0 = splitVertically n r
+ | n <= nmaster+1 = splitVertically nmaster s1 ++ splitVertically (n-nmaster) s2
+ | otherwise = splitVertically nmaster r1 ++ splitVertically nmid r2 ++ splitVertically nright r3
where (r1, r2, r3) = split3HorizontallyBy f r
+ (s1, s2) = splitHorizontallyBy f r
nslave = (n - nmaster)
nmid = floor (nslave % 2)
nright = (n - nmaster - nmid)