diff options
author | Andrea Rossato <andrea.rossato@unibz.it> | 2007-09-25 17:23:07 +0200 |
---|---|---|
committer | Andrea Rossato <andrea.rossato@unibz.it> | 2007-09-25 17:23:07 +0200 |
commit | 77aa915ca92efbf7d6c3b899f76a29cc1dc50549 (patch) | |
tree | 806cba7ed21c9dcaa04a61bfe8f6f6a78742685c | |
parent | fd42f8fdae3f3afbc138270091081bdf90d38248 (diff) | |
download | XMonadContrib-77aa915ca92efbf7d6c3b899f76a29cc1dc50549.tar.gz XMonadContrib-77aa915ca92efbf7d6c3b899f76a29cc1dc50549.tar.xz XMonadContrib-77aa915ca92efbf7d6c3b899f76a29cc1dc50549.zip |
make Accordion work with Layout class
darcs-hash:20070925152307-32816-a6ca5eadfd3f402701822053613b86c0976ff1ed.gz
-rw-r--r-- | Accordion.hs | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/Accordion.hs b/Accordion.hs index 74c53b5..5bfd77f 100644 --- a/Accordion.hs +++ b/Accordion.hs @@ -15,14 +15,13 @@ module XMonadContrib.Accordion ( -- * Usage -- $usage - accordion) where + Accordion(Accordion)) where import XMonad import Operations import qualified StackSet as W import Graphics.X11.Xlib import Data.Ratio -import XMonadContrib.LayoutHelpers ( idModify ) -- $usage -- > import XMonadContrib.Accordion @@ -31,22 +30,24 @@ import XMonadContrib.LayoutHelpers ( idModify ) -- %import XMonadContrib.Accordion -- %layout , accordion -accordion :: Eq a => Layout a -accordion = Layout { doLayout = accordionLayout, modifyLayout = idModify } +data Accordion a = Accordion deriving ( Read, Show ) -accordionLayout :: Eq a => Rectangle -> W.Stack a -> X ([(a, Rectangle)], Maybe (Layout a)) +instance Layout Accordion Window where + doLayout _ = accordionLayout + +accordionLayout :: Eq a => Rectangle -> W.Stack a -> X ([(a, Rectangle)], Maybe (Accordion a)) accordionLayout sc ws = return ((zip ups tops) ++ [(W.focus ws, mainPane)] ++ (zip dns bottoms) ,Nothing) where ups = W.up ws dns = W.down ws - (top, allButTop) = splitVerticallyBy (1%8) sc - (center, bottom) = splitVerticallyBy (6%7) allButTop - (allButBottom, _) = splitVerticallyBy (7%8) sc + (top, allButTop) = splitVerticallyBy (1%8 :: Ratio Int) sc + (center, bottom) = splitVerticallyBy (6%7 :: Ratio Int) allButTop + (allButBottom, _) = splitVerticallyBy (7%8 :: Ratio Int) sc mainPane | ups /= [] && dns /= [] = center | ups /= [] = allButTop | dns /= [] = allButBottom | otherwise = sc - tops = if ups /= [] then splitVertically (length ups) top else [] - bottoms= if dns /= [] then splitVertically (length dns) bottom else [] + tops = if ups /= [] then splitVertically (length ups) top else [] + bottoms = if dns /= [] then splitVertically (length dns) bottom else [] |