diff options
Diffstat (limited to '')
-rw-r--r-- | LayoutHints.hs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/LayoutHints.hs b/LayoutHints.hs new file mode 100644 index 0000000..b24dc4a --- /dev/null +++ b/LayoutHints.hs @@ -0,0 +1,21 @@ +module XMonadContrib.LayoutHints ( layoutHints ) where + +-- to use: +-- defaultLayouts = [ layoutHints tiled, layoutHints $ mirror tiled , full ] + +import Operations ( applySizeHints ) +import Graphics.X11.Xlib +import Graphics.X11.Xlib.Extras ( getWMNormalHints ) +import XMonad hiding ( trace ) + +layoutHints :: Layout -> Layout +layoutHints l = Layout { doLayout = \r x -> doLayout l r x >>= applyHints + , modifyLayout = \x -> layoutHints `fmap` modifyLayout l x } + +applyHints :: [(Window, Rectangle)] -> X [(Window, Rectangle)] +applyHints xs = mapM applyHint xs + where applyHint (w,Rectangle a b c d) = + withDisplay $ \disp -> + do sh <- io $ getWMNormalHints disp w + let (c',d') = applySizeHints sh (c,d) + return (w, Rectangle a b c' d') |