mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-08-07 07:21:53 -07:00
handle messages in X.L.IfMax
This commit is contained in:
@@ -23,6 +23,7 @@ module XMonad.Layout.IfMax
|
|||||||
, ifMax
|
, ifMax
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import Control.Applicative((<$>))
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
|
|
||||||
import XMonad
|
import XMonad
|
||||||
@@ -63,6 +64,16 @@ instance (LayoutClass l1 a, LayoutClass l2 a) => LayoutClass (IfMax l1 l2) a whe
|
|||||||
let l2' = fromMaybe l2 ml2'
|
let l2' = fromMaybe l2 ml2'
|
||||||
return (wrs, Just $ IfMax n l1 l2')
|
return (wrs, Just $ IfMax n l1 l2')
|
||||||
|
|
||||||
|
handleMessage (IfMax n l1 l2) m = do
|
||||||
|
len <- gets (length . W.integrate' . W.stack . W.workspace . W.current . windowset)
|
||||||
|
if len <= n
|
||||||
|
then do
|
||||||
|
l1' <- handleMessage l1 m
|
||||||
|
return $ flip (IfMax n) l2 <$> l1'
|
||||||
|
else do
|
||||||
|
l2' <- handleMessage l2 m
|
||||||
|
return $ IfMax n l1 <$> l2'
|
||||||
|
|
||||||
description (IfMax n l1 l2) = "If number of windows is <= " ++ show n ++ ", then " ++
|
description (IfMax n l1 l2) = "If number of windows is <= " ++ show n ++ ", then " ++
|
||||||
description l1 ++ ", else " ++ description l2
|
description l1 ++ ", else " ++ description l2
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user