mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 11:30:22 -07:00
add new dock if it hasn't strut properties
This commit is contained in:
parent
f4d4bde026
commit
83ee18ad94
@ -104,7 +104,7 @@ import Data.Maybe (fromMaybe, catMaybes)
|
|||||||
manageDocks :: ManageHook
|
manageDocks :: ManageHook
|
||||||
manageDocks = checkDock --> (doIgnore <+> clearGapCache)
|
manageDocks = checkDock --> (doIgnore <+> clearGapCache)
|
||||||
where clearGapCache = do
|
where clearGapCache = do
|
||||||
liftX (broadcastMessage ClearGapCache)
|
liftX $ (broadcastMessage ClearGapCache)
|
||||||
mempty
|
mempty
|
||||||
|
|
||||||
-- | Checks if a window is a DOCK or DESKTOP window
|
-- | Checks if a window is a DOCK or DESKTOP window
|
||||||
@ -122,26 +122,24 @@ checkDock = ask >>= \w -> liftX $ do
|
|||||||
docksEventHook :: Event -> X All
|
docksEventHook :: Event -> X All
|
||||||
docksEventHook (MapNotifyEvent {ev_window = w}) = do
|
docksEventHook (MapNotifyEvent {ev_window = w}) = do
|
||||||
whenX ((not `fmap` (isClient w)) <&&> runQuery checkDock w) $ do
|
whenX ((not `fmap` (isClient w)) <&&> runQuery checkDock w) $ do
|
||||||
mrstrut <- getRawStrut w
|
rstrut <- getRawStrut w
|
||||||
case mrstrut of
|
broadcastMessage (NewDock rstrut)
|
||||||
Just rstrut -> broadcastMessage (NewDock rstrut)
|
|
||||||
Nothing -> broadcastMessage ClearGapCache
|
|
||||||
refresh
|
refresh
|
||||||
return (All True)
|
return (All True)
|
||||||
docksEventHook _ = return (All True)
|
docksEventHook _ = return (All True)
|
||||||
|
|
||||||
getRawStrut :: Window -> X (Maybe (Window, Either [CLong] [CLong]))
|
getRawStrut :: Window -> X (Window, Maybe (Either [CLong] [CLong]))
|
||||||
getRawStrut w = do
|
getRawStrut w = do
|
||||||
msp <- fromMaybe [] <$> getProp32s "_NET_WM_STRUT_PARTIAL" w
|
msp <- fromMaybe [] <$> getProp32s "_NET_WM_STRUT_PARTIAL" w
|
||||||
if null msp
|
if null msp
|
||||||
then do
|
then do
|
||||||
mp <- fromMaybe [] <$> getProp32s "_NET_WM_STRUT" w
|
mp <- fromMaybe [] <$> getProp32s "_NET_WM_STRUT" w
|
||||||
if null mp then return Nothing
|
if null mp then return (w, Nothing)
|
||||||
else return (Just (w, Left mp))
|
else return (w, Just (Left mp))
|
||||||
else return (Just (w, Right msp))
|
else return (w, Just (Right msp))
|
||||||
|
|
||||||
getRawStruts :: S.Set Window -> X (S.Set (Window, Either [CLong] [CLong]))
|
getRawStruts :: S.Set Window -> X (S.Set (Window, Maybe (Either [CLong] [CLong])))
|
||||||
getRawStruts wins = (S.fromList . catMaybes) <$> mapM getRawStrut (S.toList wins)
|
getRawStruts wins = S.fromList <$> mapM getRawStrut (S.toList wins)
|
||||||
|
|
||||||
|
|
||||||
-- | Gets the STRUT config, if present, in xmonad gap order
|
-- | Gets the STRUT config, if present, in xmonad gap order
|
||||||
@ -198,7 +196,7 @@ avoidStrutsOn ss = ModifiedLayout $ AvoidStruts (S.fromList ss) Nothing S.empty
|
|||||||
data AvoidStruts a = AvoidStruts {
|
data AvoidStruts a = AvoidStruts {
|
||||||
avoidStrutsDirection :: S.Set Direction2D,
|
avoidStrutsDirection :: S.Set Direction2D,
|
||||||
avoidStrutsRectCache :: Maybe (S.Set Direction2D, Rectangle, Rectangle ),
|
avoidStrutsRectCache :: Maybe (S.Set Direction2D, Rectangle, Rectangle ),
|
||||||
strutSet :: S.Set (Window, Either [CLong] [CLong])
|
strutSet :: S.Set (Window, Maybe (Either [CLong] [CLong]))
|
||||||
} deriving ( Read, Show )
|
} deriving ( Read, Show )
|
||||||
|
|
||||||
-- | Message type which can be sent to an 'AvoidStruts' layout
|
-- | Message type which can be sent to an 'AvoidStruts' layout
|
||||||
@ -213,7 +211,7 @@ instance Message ToggleStruts
|
|||||||
-- | message sent to ensure that caching the gaps won't give a wrong result
|
-- | message sent to ensure that caching the gaps won't give a wrong result
|
||||||
-- because a new dock has been added
|
-- because a new dock has been added
|
||||||
data NewDock = ClearGapCache
|
data NewDock = ClearGapCache
|
||||||
| NewDock (Window, Either [CLong] [CLong])
|
| NewDock (Window, Maybe (Either [CLong] [CLong]))
|
||||||
deriving (Read,Show,Typeable)
|
deriving (Read,Show,Typeable)
|
||||||
instance Message NewDock
|
instance Message NewDock
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user