diff options
author | Braden Shepherdson <Braden.Shepherdson@gmail.com> | 2008-02-25 19:33:37 +0100 |
---|---|---|
committer | Braden Shepherdson <Braden.Shepherdson@gmail.com> | 2008-02-25 19:33:37 +0100 |
commit | c72acaf81a7b7353151a4beb98d4c0c8840baa51 (patch) | |
tree | d3b9e5ae6a6336503ebf88a791929dee33204535 /XMonad/Hooks | |
parent | 49697e53dd5ba510679706e3d1c71750fa24ae62 (diff) | |
download | XMonadContrib-c72acaf81a7b7353151a4beb98d4c0c8840baa51.tar.gz XMonadContrib-c72acaf81a7b7353151a4beb98d4c0c8840baa51.tar.xz XMonadContrib-c72acaf81a7b7353151a4beb98d4c0c8840baa51.zip |
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
Diffstat (limited to 'XMonad/Hooks')
-rw-r--r-- | XMonad/Hooks/ManageHelpers.hs | 18 |
1 files changed, 17 insertions, 1 deletions
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 + |