mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 11:30:22 -07:00
LayoutModifier: add emptyLayoutMod for dealing with empty workspaces
This commit is contained in:
parent
efc4ad95b8
commit
e9f0f05217
@ -49,6 +49,9 @@ class (Show (m a), Read (m a)) => LayoutModifier m a where
|
|||||||
pureModifier :: m a -> Rectangle -> Stack a -> [(a, Rectangle)]
|
pureModifier :: m a -> Rectangle -> Stack a -> [(a, Rectangle)]
|
||||||
-> ([(a, Rectangle)], Maybe (m a))
|
-> ([(a, Rectangle)], Maybe (m a))
|
||||||
pureModifier _ _ _ wrs = (wrs, Nothing)
|
pureModifier _ _ _ wrs = (wrs, Nothing)
|
||||||
|
emptyLayoutMod :: m a -> Rectangle -> [(a, Rectangle)]
|
||||||
|
-> X ([(a, Rectangle)], Maybe (m a))
|
||||||
|
emptyLayoutMod _ _ _ = return ([], Nothing)
|
||||||
hook :: m a -> X ()
|
hook :: m a -> X ()
|
||||||
hook _ = return ()
|
hook _ = return ()
|
||||||
unhook :: m a -> X ()
|
unhook :: m a -> X ()
|
||||||
@ -64,6 +67,13 @@ instance (LayoutModifier m a, LayoutClass l a) => LayoutClass (ModifiedLayout m
|
|||||||
Just m' -> Just $ (ModifiedLayout m') $ maybe l id ml'
|
Just m' -> Just $ (ModifiedLayout m') $ maybe l id ml'
|
||||||
Nothing -> ModifiedLayout m `fmap` ml'
|
Nothing -> ModifiedLayout m `fmap` ml'
|
||||||
return (ws', ml'')
|
return (ws', ml'')
|
||||||
|
emptyLayout (ModifiedLayout m l) r =
|
||||||
|
do (ws, ml') <- emptyLayout l r
|
||||||
|
(ws',mm') <- emptyLayoutMod m r ws
|
||||||
|
let ml'' = case mm' of
|
||||||
|
Just m' -> Just $ (ModifiedLayout m') $ maybe l id ml'
|
||||||
|
Nothing -> ModifiedLayout m `fmap` ml'
|
||||||
|
return (ws', ml'')
|
||||||
handleMessage (ModifiedLayout m l) mess =
|
handleMessage (ModifiedLayout m l) mess =
|
||||||
do mm' <- handleMessOrMaybeModifyIt m mess
|
do mm' <- handleMessOrMaybeModifyIt m mess
|
||||||
ml' <- case mm' of
|
ml' <- case mm' of
|
||||||
|
Loading…
x
Reference in New Issue
Block a user