0
我想實現自定義消息以通過自定義佈局進行處理。如何在Xmonad中創建和處理自定義消息?
data ModifySideContainer = IncrementLeftColumnContainer | IncrementRightColumnContainer deriving Typeable
instance Message ModifySideContainer
我也不太清楚瞭如何在pureMessage
(https://hackage.haskell.org/package/xmonad-0.13/docs/XMonad-Core.html#v:pureMessage)
這是我目前PureMessage的實現(自定義佈局內)處理自定義消息:
pureMessage [email protected](MiddleColumn sr mcc deltaInc _) m = msum [
fmap resize (fromMessage m),
fmap incmastern (fromMessage m)
]
where
resize Expand = l {splitRatio = (min 0.5 $ sr + deltaInc)}
resize Shrink = l {splitRatio = (max 0 $ sr - deltaInc)}
incmastern (IncMasterN x) = l { middleColumnCount = max 0 (mcc+x) }
我不不太明白這個邏輯是如何工作的(我從某處複製它),msum
在這裏做什麼?我想我會知道,一旦我找到的實例聲明mplus
。