From 80b329853df0717cc99dfadd951222c6a365b2f2 Mon Sep 17 00:00:00 2001 From: Jason Creighton Date: Tue, 3 Apr 2007 06:06:58 +0200 Subject: vertical (master area on top) tiling darcs-hash:20070403040658-b9aa7-4bbe82e188fd19de00f8d6f86a3e4d3b4a39bf01.gz --- Operations.hs | 12 +++++++++--- XMonad.hs | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Operations.hs b/Operations.hs index 2558449..046c75b 100644 --- a/Operations.hs +++ b/Operations.hs @@ -38,14 +38,12 @@ refresh = do case layoutType fl of Full -> fmap (flip (,) sc) $ maybeToList $ W.peekStack n ws Horz -> tile (tileFraction fl) sc $ W.index n ws + Vert -> vtile (tileFraction fl) sc $ W.index n ws whenJust (W.peekStack n ws) (io . raiseWindow d) whenJust (W.peek ws) setFocus -- | tile. Compute the positions for windows in horizontal layout -- mode. --- --- TODO generalize this to vertical layout --- tile :: Rational -> Rectangle -> [Window] -> [(Window, Rectangle)] tile _ _ [] = [] tile _ d [w] = [(w, d)] @@ -57,6 +55,14 @@ tile r (Rectangle sx sy sw sh) (w:s) rh = fromIntegral sh `div` fromIntegral (length s) f i a = (a, Rectangle (sx + lw) i rw (fromIntegral rh)) +-- | vtile. Tile vertically. +vtile :: Rational -> Rectangle -> [Window] -> [(Window, Rectangle)] +vtile r rect ws = map (\(w, wr) -> (w, flipRect wr)) $ tile r (flipRect rect) ws + +flipRect :: Rectangle -> Rectangle +flipRect (Rectangle { rect_x = x, rect_y = y, rect_width = w, rect_height = h }) + = Rectangle { rect_x = y, rect_y = x, rect_width = h, rect_height = w } + -- | switchLayout. Switch to another layout scheme. Switches the -- current workspace. switchLayout :: X () diff --git a/XMonad.hs b/XMonad.hs index d74de48..94b0ed1 100644 --- a/XMonad.hs +++ b/XMonad.hs @@ -51,7 +51,7 @@ data XState = XState type WorkSpace = StackSet Window -- | The different layout modes -data Layout = Full | Horz deriving (Enum, Bounded) +data Layout = Full | Horz | Vert deriving (Enum, Bounded) -- | 'rot' for Layout. rot :: Layout -> Layout -- cgit v1.2.3