Spiral: haddock docs

This commit is contained in:
Andrea Rossato 2007-11-23 13:50:23 +00:00
parent 3885445b26
commit de23c9ab0d

View File

@ -5,7 +5,7 @@
-- Module : XMonad.Layout.Spiral -- Module : XMonad.Layout.Spiral
-- Copyright : (c) Joe Thornber <joe.thornber@gmail.com> -- Copyright : (c) Joe Thornber <joe.thornber@gmail.com>
-- License : BSD3-style (see LICENSE) -- License : BSD3-style (see LICENSE)
-- --
-- Maintainer : Joe Thornber <joe.thornber@gmail.com> -- Maintainer : Joe Thornber <joe.thornber@gmail.com>
-- Stability : stable -- Stability : stable
-- Portability : portable -- Portability : portable
@ -30,14 +30,19 @@ import XMonad.Layouts
import XMonad.StackSet ( integrate ) import XMonad.StackSet ( integrate )
-- $usage -- $usage
-- You can use this module with the following in your Config.hs file: -- You can use this module with the following in your @~\/.xmonad\/xmonad.hs@:
-- --
-- > import XMonad.Layout.Spiral -- > import XMonad.Layout.Spiral
-- > import Data.Ratio
-- --
-- > layouts = [ ..., Layout $ spiral (1 % 1), ... ] -- Then edit your @layoutHook@ by adding the Spiral layout:
--
-- %import XMonad.Layout.Spiral -- > myLayouts = spiral (1 % 1) ||| etc..
-- %layout , Layout $ spiral (1 % 1) -- > main = xmonad dafaultConfig { layoutHook = myLayouts }
--
-- For more detailed instructions on editing the layoutHook see:
--
-- "XMonad.Doc.Extending#Editing_the_layout_hook"
fibs :: [Integer] fibs :: [Integer]
fibs = 1 : 1 : zipWith (+) fibs (tail fibs) fibs = 1 : 1 : zipWith (+) fibs (tail fibs)
@ -71,7 +76,7 @@ instance LayoutClass SpiralWithDir a where
ratios = blend scale . reverse . take (length ws - 1) . mkRatios $ tail fibs ratios = blend scale . reverse . take (length ws - 1) . mkRatios $ tail fibs
rects = divideRects (zip ratios dirs) sc rects = divideRects (zip ratios dirs) sc
dirs = dropWhile (/= dir) $ case rot of dirs = dropWhile (/= dir) $ case rot of
CW -> cycle [East .. North] CW -> cycle [East .. North]
CCW -> cycle [North, West, South, East] CCW -> cycle [North, West, South, East]
handleMessage (SpiralWithDir dir rot scale) = return . fmap resize . fromMessage handleMessage (SpiralWithDir dir rot scale) = return . fmap resize . fromMessage
where resize Expand = spiralWithDir dir rot $ (21 % 20) * scale where resize Expand = spiralWithDir dir rot $ (21 % 20) * scale