Dishes: tabs

This commit is contained in:
Spencer Janssen 2007-11-01 09:02:37 +00:00
parent ea8cd6d2c7
commit 1f698321d7

View File

@ -17,7 +17,7 @@
module XMonadContrib.Dishes ( module XMonadContrib.Dishes (
-- * Usage -- * Usage
-- $usage -- $usage
Dishes (..) Dishes (..)
) where ) where
@ -42,16 +42,16 @@ import Graphics.X11.Xlib
data Dishes a = Dishes Int Rational deriving (Show, Read) data Dishes a = Dishes Int Rational deriving (Show, Read)
instance LayoutClass Dishes a where instance LayoutClass Dishes a where
doLayout (Dishes nmaster h) r = doLayout (Dishes nmaster h) r =
return . (\x->(x,Nothing)) . return . (\x->(x,Nothing)) .
ap zip (dishes h r nmaster . length) . integrate ap zip (dishes h r nmaster . length) . integrate
pureMessage (Dishes nmaster h) m = fmap incmastern (fromMessage m) pureMessage (Dishes nmaster h) m = fmap incmastern (fromMessage m)
where incmastern (IncMasterN d) = Dishes (max 0 (nmaster+d)) h where incmastern (IncMasterN d) = Dishes (max 0 (nmaster+d)) h
dishes :: Rational -> Rectangle -> Int -> Int -> [Rectangle] dishes :: Rational -> Rectangle -> Int -> Int -> [Rectangle]
dishes h s nmaster n = if n <= nmaster dishes h s nmaster n = if n <= nmaster
then splitHorizontally n s then splitHorizontally n s
else ws else ws
where where
(m,rest) = splitVerticallyBy (1 - (fromIntegral $ n - nmaster) * h) s (m,rest) = splitVerticallyBy (1 - (fromIntegral $ n - nmaster) * h) s
ws = splitHorizontally nmaster m ++ splitVertically (n - nmaster) rest ws = splitHorizontally nmaster m ++ splitVertically (n - nmaster) rest