mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-08-11 18:22:16 -07:00
add calcGapForAll for other modules
This commit is contained in:
@@ -33,7 +33,7 @@ import Data.Maybe (listToMaybe,fromJust,isNothing)
|
|||||||
import qualified XMonad.StackSet as W
|
import qualified XMonad.StackSet as W
|
||||||
import qualified Data.Set as S
|
import qualified Data.Set as S
|
||||||
|
|
||||||
import XMonad.Hooks.ManageDocks (calcGap)
|
import XMonad.Hooks.ManageDocks (calcGapForAll)
|
||||||
import XMonad.Util.Types (Direction2D(..))
|
import XMonad.Util.Types (Direction2D(..))
|
||||||
import XMonad.Actions.AfterDrag
|
import XMonad.Actions.AfterDrag
|
||||||
|
|
||||||
@@ -291,7 +291,7 @@ getSnap horiz collidedist d w = do
|
|||||||
screen <- W.current <$> gets windowset
|
screen <- W.current <$> gets windowset
|
||||||
let sr = screenRect $ W.screenDetail screen
|
let sr = screenRect $ W.screenDetail screen
|
||||||
wl = W.integrate' . W.stack $ W.workspace screen
|
wl = W.integrate' . W.stack $ W.workspace screen
|
||||||
gr <- fmap ($sr) $ calcGap $ S.fromList [minBound .. maxBound]
|
gr <- fmap ($sr) $ calcGapForAll $ S.fromList [minBound .. maxBound]
|
||||||
wla <- filter (collides wa) `fmap` (io $ mapM (getWindowAttributes d) $ filter (/=w) wl)
|
wla <- filter (collides wa) `fmap` (io $ mapM (getWindowAttributes d) $ filter (/=w) wl)
|
||||||
|
|
||||||
return ( neighbours (back wa sr gr wla) (wpos wa)
|
return ( neighbours (back wa sr gr wla) (wpos wa)
|
||||||
|
@@ -28,7 +28,7 @@ module XMonad.Hooks.ManageDocks (
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
-- for XMonad.Actions.FloatSnap
|
-- for XMonad.Actions.FloatSnap
|
||||||
calcGap
|
calcGap, calcGapForAll
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
|
||||||
@@ -160,6 +160,12 @@ getStrut w = do
|
|||||||
[(L, l, ly1, ly2), (R, r, ry1, ry2), (U, t, tx1, tx2), (D, b, bx1, bx2)]
|
[(L, l, ly1, ly2), (R, r, ry1, ry2), (U, t, tx1, tx2), (D, b, bx1, bx2)]
|
||||||
parseStrutPartial _ = []
|
parseStrutPartial _ = []
|
||||||
|
|
||||||
|
calcGapForAll :: S Set Direction2D -> X (Rectangle -> Rectangle)
|
||||||
|
calcGapForAll ss = withDisplay $ \dpy -> do
|
||||||
|
rootw <- asks theRoot
|
||||||
|
(_,_,wins) <- io $ queryTree dpy rootw
|
||||||
|
calcGap (S.fromList wins) ss
|
||||||
|
|
||||||
-- | Goes through the list of windows and find the gap so that all
|
-- | Goes through the list of windows and find the gap so that all
|
||||||
-- STRUT settings are satisfied.
|
-- STRUT settings are satisfied.
|
||||||
calcGap :: S.Set Window -> S.Set Direction2D -> X (Rectangle -> Rectangle)
|
calcGap :: S.Set Window -> S.Set Direction2D -> X (Rectangle -> Rectangle)
|
||||||
|
@@ -90,8 +90,7 @@ positionStoreInit mDecoTheme w = withDisplay $ \d -> do
|
|||||||
let sr = screenRect . W.screenDetail $ sc
|
let sr = screenRect . W.screenDetail $ sc
|
||||||
rootw <- asks theRoot
|
rootw <- asks theRoot
|
||||||
(_,_,wins) <- io $ queryTree d rootw
|
(_,_,wins) <- io $ queryTree d rootw
|
||||||
sr' <- fmap ($ sr) (calcGap (S.fromList wins) $
|
sr' <- fmap ($ sr) (calcGapForAll $ S.fromList [minBound .. maxBound]) -- take docks into account, accepting
|
||||||
S.fromList [minBound .. maxBound]) -- take docks into account, accepting
|
|
||||||
-- a somewhat unfortunate inter-dependency
|
-- a somewhat unfortunate inter-dependency
|
||||||
-- with 'XMonad.Hooks.ManageDocks'
|
-- with 'XMonad.Hooks.ManageDocks'
|
||||||
modifyPosStore (\ps -> posStoreInsert ps w
|
modifyPosStore (\ps -> posStoreInsert ps w
|
||||||
|
@@ -106,8 +106,8 @@ handleScreenCrossing w decoWin = withDisplay $ \d -> do
|
|||||||
{-- somewhat ugly hack to get proper ScreenRect,
|
{-- somewhat ugly hack to get proper ScreenRect,
|
||||||
creates unwanted inter-dependencies
|
creates unwanted inter-dependencies
|
||||||
TODO: get ScreenRects in a proper way --}
|
TODO: get ScreenRects in a proper way --}
|
||||||
oldScreenRect' <- fmap ($ oldScreenRect) (calcGap $ S.fromList [minBound .. maxBound])
|
oldScreenRect' <- fmap ($ oldScreenRect) (calcGapForAll $ S.fromList [minBound .. maxBound])
|
||||||
newScreenRect' <- fmap ($ newScreenRect) (calcGap $ S.fromList [minBound .. maxBound])
|
newScreenRect' <- fmap ($ newScreenRect) (calcGapForAll $ S.fromList [minBound .. maxBound])
|
||||||
wa <- io $ getWindowAttributes d decoWin
|
wa <- io $ getWindowAttributes d decoWin
|
||||||
modifyPosStore (\ps ->
|
modifyPosStore (\ps ->
|
||||||
posStoreMove ps w (fi $ wa_x wa) (fi $ wa_y wa)
|
posStoreMove ps w (fi $ wa_x wa) (fi $ wa_y wa)
|
||||||
|
Reference in New Issue
Block a user