mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 11:30:22 -07:00
X.H.ManageHelpers: Factor doShiftTo out of transience and switch to W.shiftWin
Will be useful for shiftToLeader. Use W.shiftWin instead of W.shift as it isn't guaranteed that the window being managed by the ManageHook is still in focus.
This commit is contained in:
parent
8202594b1d
commit
289c7e433a
@ -217,10 +217,7 @@ ledFrom = ask >>= liftX . withWindowSet . findTagLeader
|
|||||||
-- | A convenience 'MaybeManageHook' that will check to see if a window
|
-- | A convenience 'MaybeManageHook' that will check to see if a window
|
||||||
-- is transient, and then move it to its parent.
|
-- is transient, and then move it to its parent.
|
||||||
transience :: MaybeManageHook
|
transience :: MaybeManageHook
|
||||||
transience = transientTo </=? Nothing -?>> move
|
transience = transientTo </=? Nothing -?>> maybe idHook doShiftTo
|
||||||
where
|
|
||||||
move mw = maybe idHook (doF . move') mw
|
|
||||||
move' w s = maybe s (`W.shift` s) (W.findTag w s)
|
|
||||||
|
|
||||||
-- | 'transience' set to a 'ManageHook'
|
-- | 'transience' set to a 'ManageHook'
|
||||||
transience' :: ManageHook
|
transience' :: ManageHook
|
||||||
@ -239,6 +236,11 @@ shiftToLeader' = maybeToDefinite shiftToLeader
|
|||||||
maybeToDefinite :: (Monoid a, Functor m) => m (Maybe a) -> m a
|
maybeToDefinite :: (Monoid a, Functor m) => m (Maybe a) -> m a
|
||||||
maybeToDefinite = fmap (fromMaybe mempty)
|
maybeToDefinite = fmap (fromMaybe mempty)
|
||||||
|
|
||||||
|
-- | Move the window to the same workspace as another window.
|
||||||
|
doShiftTo :: Window -> ManageHook
|
||||||
|
doShiftTo target = doF . shiftTo =<< ask
|
||||||
|
where shiftTo w s = maybe s (\t -> W.shiftWin t w s) (W.findTag target s)
|
||||||
|
|
||||||
-- | Floats the new window in the given rectangle.
|
-- | 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.
|
doRectFloat :: W.RationalRect -- ^ The rectangle to float the window in. 0 to 1; x, y, w, h.
|
||||||
-> ManageHook
|
-> ManageHook
|
||||||
|
Loading…
x
Reference in New Issue
Block a user