mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 11:30:22 -07:00
LayoutModifier: add pureMess and pureModifier to the LayoutModifier class
This commit is contained in:
parent
a07b207023
commit
efc4ad95b8
@ -36,14 +36,19 @@ class (Show (m a), Read (m a)) => LayoutModifier m a where
|
||||
handleMess :: m a -> SomeMessage -> X (Maybe (m a))
|
||||
handleMess m mess | Just Hide <- fromMessage mess = doUnhook
|
||||
| Just ReleaseResources <- fromMessage mess = doUnhook
|
||||
| otherwise = return Nothing
|
||||
| otherwise = return $ pureMess m mess
|
||||
where doUnhook = do unhook m; return Nothing
|
||||
handleMessOrMaybeModifyIt :: m a -> SomeMessage -> X (Maybe (Either (m a) SomeMessage))
|
||||
handleMessOrMaybeModifyIt m mess = do mm' <- handleMess m mess
|
||||
return (Left `fmap` mm')
|
||||
pureMess :: m a -> SomeMessage -> Maybe (m a)
|
||||
pureMess _ _ = Nothing
|
||||
redoLayout :: m a -> Rectangle -> Stack a -> [(a, Rectangle)]
|
||||
-> X ([(a, Rectangle)], Maybe (m a))
|
||||
redoLayout m _ _ wrs = do hook m; return (wrs, Nothing)
|
||||
redoLayout m r s wrs = do hook m; return $ pureModifier m r s wrs
|
||||
pureModifier :: m a -> Rectangle -> Stack a -> [(a, Rectangle)]
|
||||
-> ([(a, Rectangle)], Maybe (m a))
|
||||
pureModifier _ _ _ wrs = (wrs, Nothing)
|
||||
hook :: m a -> X ()
|
||||
hook _ = return ()
|
||||
unhook :: m a -> X ()
|
||||
|
Loading…
x
Reference in New Issue
Block a user