aboutsummaryrefslogtreecommitdiffstats
path: root/Roledex.hs
diff options
context:
space:
mode:
authorAndrea Rossato <andrea.rossato@unibz.it>2007-09-25 17:32:37 +0200
committerAndrea Rossato <andrea.rossato@unibz.it>2007-09-25 17:32:37 +0200
commit88c3e1b291426ab3cb1b3973fcbb81daaf554c56 (patch)
treeeba2efe0fe359c2353a4a6bf2a1e5da644bd2b7c /Roledex.hs
parent77aa915ca92efbf7d6c3b899f76a29cc1dc50549 (diff)
downloadXMonadContrib-88c3e1b291426ab3cb1b3973fcbb81daaf554c56.tar.gz
XMonadContrib-88c3e1b291426ab3cb1b3973fcbb81daaf554c56.tar.xz
XMonadContrib-88c3e1b291426ab3cb1b3973fcbb81daaf554c56.zip
make Roledex work with Layout class
darcs-hash:20070925153237-32816-49ad6a61af4afb3e89924c4c5b9f30d43af3eab4.gz
Diffstat (limited to 'Roledex.hs')
-rw-r--r--Roledex.hs13
1 files changed, 7 insertions, 6 deletions
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