aboutsummaryrefslogtreecommitdiff
path: root/src/Internal/Layout.hs
blob: bdac6d113f2659f3212ad643f725bddfae963b06 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
{-# LANGUAGE MultiParamTypeClasses, FlexibleInstances #-}
module Internal.Layout where 

import XMonad.Layout.Spiral
import XMonad.Layout.ThreeColumns
import XMonad.Layout.Grid
import XMonad.Layout
import XMonad

import qualified XMonad.StackSet as W

myLayout =
    spiral (6/7) |||
    Tall 1 (3/100) (1/2) |||
    ThreeCol 1 (3/100) (1/2) |||
    Grid

data Manual = Manual RectSet

data RectSet =
      RectSet {
                rectSetWidth :: Float -- 0.0 - 1.0 fraction of the float.
              , rectSetHeight :: Float
              , subRects :: RectChildren
              }

data RectChildren =
      Leaf { boundWindow :: Maybe Window } |
      Children { children :: [RectSet] }

data RectSetD =
    LeafD {
      boundWindowD :: Maybe Window
    , parent :: RectParentD
    } |
    Parent { self :: RectParentD }

data RectParentD =
    RectParentD {
      currentChild :: RectSetD

    , leftChildren :: [RectSetD]
    , rightChildren :: [RectSetD]

    , rectSetDWidth :: Float
    , rectSetDHeight :: Float

    , parentRect :: Maybe RectParentD
    }

derive :: RectSet -> Window -> Maybe RectSetD
derive (RectSet w h sub) = undefined

getWindowRect :: Window -> X (Maybe Rectangle)
getWindowRect win = withDisplay $ \dpy -> do
    (_, x, y, w, h, bw, _) <- liftIO $ getGeometry dpy win
    catchX
      (return $ Just $ Rectangle x y (w + 2 * bw) (h + 2 * bw))
      (return Nothing)