From 88c3e1b291426ab3cb1b3973fcbb81daaf554c56 Mon Sep 17 00:00:00 2001 From: Andrea Rossato Date: Tue, 25 Sep 2007 17:32:37 +0200 Subject: make Roledex work with Layout class darcs-hash:20070925153237-32816-49ad6a61af4afb3e89924c4c5b9f30d43af3eab4.gz --- Roledex.hs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'Roledex.hs') diff --git a/Roledex.hs b/Roledex.hs index 89c0f24..015f703 100644 --- a/Roledex.hs +++ b/Roledex.hs @@ -16,14 +16,13 @@ module XMonadContrib.Roledex ( -- * Usage -- $usage - roledex) where + Roledex(Roledex)) where import XMonad import Operations import qualified StackSet as W import Graphics.X11.Xlib import Data.Ratio -import XMonadContrib.LayoutHelpers ( idModify ) -- $usage -- @@ -33,10 +32,12 @@ import XMonadContrib.LayoutHelpers ( idModify ) -- %import XMonadContrib.Roledex -- %layout , roledex -roledex :: Eq a => Layout a -roledex = Layout { doLayout = roledexLayout, modifyLayout = idModify } +data Roledex a = Roledex deriving ( Show, Read ) -roledexLayout :: Eq a => Rectangle -> W.Stack a -> X ([(a, Rectangle)], Maybe (Layout a)) +instance Layout Roledex Window where + doLayout _ = roledexLayout + +roledexLayout :: Eq a => Rectangle -> W.Stack a -> X ([(a, Rectangle)], Maybe (Roledex a)) roledexLayout sc ws = return ([(W.focus ws, mainPane)] ++ (zip ups tops) ++ (reverse (zip dns bottoms)) @@ -44,7 +45,7 @@ roledexLayout sc ws = return ([(W.focus ws, mainPane)] ++ where ups = W.up ws dns = W.down ws c = length ups + length dns - rect = fst $ splitHorizontallyBy (2% 3) $ fst (splitVerticallyBy (2% 3) sc) + rect = fst $ splitHorizontallyBy (2%3 :: Ratio Int) $ fst (splitVerticallyBy (2%3 :: Ratio Int) sc) gw = div' (w - rw) (fromIntegral c) where (Rectangle _ _ w _) = sc -- cgit v1.2.3