From c72acaf81a7b7353151a4beb98d4c0c8840baa51 Mon Sep 17 00:00:00 2001 From: Braden Shepherdson Date: Mon, 25 Feb 2008 19:33:37 +0100 Subject: Two new floating window ManageHooks. Adds doRectFloat, which floats the new window in the given rectangle; and doCenterFloat, which floats the new window with its original size, but centered. darcs-hash:20080225183337-d53a8-e9e6680266618483dec2cd900e9be8219e1e89f7.gz --- XMonad/Hooks/ManageHelpers.hs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'XMonad/Hooks/ManageHelpers.hs') diff --git a/XMonad/Hooks/ManageHelpers.hs b/XMonad/Hooks/ManageHelpers.hs index bc8733d..45f7c06 100644 --- a/XMonad/Hooks/ManageHelpers.hs +++ b/XMonad/Hooks/ManageHelpers.hs @@ -31,7 +31,9 @@ module XMonad.Hooks.ManageHelpers ( maybeToDefinite, MaybeManageHook, transience, - transience' + transience', + doRectFloat, + doCenterFloat ) where import XMonad @@ -128,3 +130,17 @@ transience' = maybeToDefinite transience -- | converts 'MaybeManageHook's to 'ManageHook's maybeToDefinite :: MaybeManageHook -> ManageHook maybeToDefinite = fmap (fromMaybe mempty) + + +-- | Floats the new window in the given rectangle. +doRectFloat :: W.RationalRect -- ^ The rectangle to float the window in. 0 to 1; x, y, w, h. + -> ManageHook +doRectFloat r = ask >>= \w -> doF (W.float w r) + + +-- | Floats a new window with its original size, but centered. +doCenterFloat :: ManageHook +doCenterFloat = ask >>= \w -> doF . W.float w . center . snd =<< liftX (floatLocation w) + where center (W.RationalRect _ _ w h) + = W.RationalRect ((1-w)/2) ((1-h)/2) w h + -- cgit v1.2.3