aboutsummaryrefslogtreecommitdiffstats
path: root/Spiral.hs
diff options
context:
space:
mode:
authorjoe.thornber <joe.thornber@gmail.com>2007-05-24 10:55:37 +0200
committerjoe.thornber <joe.thornber@gmail.com>2007-05-24 10:55:37 +0200
commit307ed257419a4b61b9e2c04ab43322d2e36c7442 (patch)
tree2c603dfef2949f48f7c66e596e6ab54952851f7c /Spiral.hs
parent613fd14c30fd9980a727a1d1df3cb0d664a3d03c (diff)
downloadXMonadContrib-307ed257419a4b61b9e2c04ab43322d2e36c7442.tar.gz
XMonadContrib-307ed257419a4b61b9e2c04ab43322d2e36c7442.tar.xz
XMonadContrib-307ed257419a4b61b9e2c04ab43322d2e36c7442.zip
[Spiral] misc tidying
darcs-hash:20070524085537-db939-c28969cbbff29f18c78150a912fcab760d263c86.gz
Diffstat (limited to 'Spiral.hs')
-rw-r--r--Spiral.hs15
1 files changed, 8 insertions, 7 deletions
diff --git a/Spiral.hs b/Spiral.hs
index f4a0452..7ec38f8 100644
--- a/Spiral.hs
+++ b/Spiral.hs
@@ -18,18 +18,19 @@ import XMonad
fibs :: [Integer]
fibs = 1 : 1 : (zipWith (+) fibs (tail fibs))
-fibRatios :: [Rational]
-fibRatios = ratios fibs
- where
- ratios (x:y:rs) = (x % y) : ratios (y:rs)
- ratios _ = []
+mkRatios :: [Integer] -> [Rational]
+mkRatios (x1:x2:xs) = (x1 % x2) : mkRatios (x2:xs)
+mkRatios _ = []
spiral :: Rational -> Layout
spiral scale = Layout { doLayout = fibLayout,
- modifyLayout = \m -> fmap resize (fromMessage m) }
+ modifyLayout = \m -> fmap resize (fromMessage m) }
where
- fibLayout sc ws = return $ zip ws (divideRects (map (* scale) . reverse . take len $ fibRatios) len East sc)
+ fibLayout sc ws = return $ zip ws rects
where len = length ws
+ ratios = map (* scale) . reverse . take len . mkRatios $ fibs
+ rects = divideRects ratios len East sc
+
resize Expand = spiral $ (11 % 10) * scale
resize Shrink = spiral $ (10 % 11) * scale