aboutsummaryrefslogtreecommitdiffstats
path: root/LayoutHints.hs
diff options
context:
space:
mode:
authorSpencer Janssen <sjanssen@cse.unl.edu>2007-09-24 08:20:00 +0200
committerSpencer Janssen <sjanssen@cse.unl.edu>2007-09-24 08:20:00 +0200
commit9b29c09a3ef081dc00dd33953975efec04611cab (patch)
treeb004b1f3573a46ed9976629e685f3c6885746e70 /LayoutHints.hs
parent53a94065eb8c21237935fe0dceb4a587038001e9 (diff)
downloadXMonadContrib-9b29c09a3ef081dc00dd33953975efec04611cab.tar.gz
XMonadContrib-9b29c09a3ef081dc00dd33953975efec04611cab.tar.xz
XMonadContrib-9b29c09a3ef081dc00dd33953975efec04611cab.zip
Use the new modifiers in LayoutHints
darcs-hash:20070924062000-a5988-b9549452719a4d5b7cdb6ef1a87d4a42502c6571.gz
Diffstat (limited to 'LayoutHints.hs')
-rw-r--r--LayoutHints.hs29
1 files changed, 16 insertions, 13 deletions
diff --git a/LayoutHints.hs b/LayoutHints.hs
index e171d16..2e8d87e 100644
--- a/LayoutHints.hs
+++ b/LayoutHints.hs
@@ -14,34 +14,37 @@
module XMonadContrib.LayoutHints (
-- * usage
-- $usage
- layoutHints) where
+ LayoutHints) where
import Operations ( applySizeHints, D )
import Graphics.X11.Xlib
import Graphics.X11.Xlib.Extras ( getWMNormalHints )
import {-#SOURCE#-} Config (borderWidth)
import XMonad hiding ( trace )
-import XMonadContrib.LayoutHelpers ( layoutModify, idModMod )
+import XMonadContrib.LayoutModifier
-- $usage
-- > import XMonadContrib.LayoutHints
-- > defaultLayouts = [ layoutHints tiled , layoutHints $ mirror tiled ]
-- %import XMonadContrib.LayoutHints
--- %layout , layoutHints tiled
--- %layout , layoutHints $ mirror tiled
+-- %layout , ModifiedLayout LayoutHints $ layoutHints tiled
+-- %layout , ModifiedLayout LayoutHints $ mirror tiled
-- | Expand a size by the given multiple of the border width. The
-- multiple is most commonly 1 or -1.
adjBorders :: Dimension -> D -> D
adjBorders mult (w,h) = (w+2*mult*borderWidth, h+2*mult*borderWidth)
-layoutHints :: Layout Window -> Layout Window
-layoutHints = layoutModify applyHints idModMod
- where applyHints _ _ xs = do xs' <- mapM applyHint xs
- return (xs', Nothing)
- applyHint (w,Rectangle a b c d) =
- withDisplay $ \disp ->
- do sh <- io $ getWMNormalHints disp w
- let (c',d') = adjBorders 1 . applySizeHints sh . adjBorders (-1) $ (c,d)
- return (w, Rectangle a b c' d')
+data LayoutHints a = LayoutHints deriving (Read, Show)
+
+instance LayoutModifier LayoutHints Window where
+ redoLayout _ _ _ xs = do
+ xs' <- mapM applyHint xs
+ return (xs', Nothing)
+ where
+ applyHint (w,Rectangle a b c d) =
+ withDisplay $ \disp -> do
+ sh <- io $ getWMNormalHints disp w
+ let (c',d') = adjBorders 1 . applySizeHints sh . adjBorders (-1) $ (c,d)
+ return (w, Rectangle a b c' d')