Generalize X.L.AutoMaster modifier

Enable it to work not only with Windows, but with any (Eq) type.
This commit is contained in:
Ilya Portnov 2011-05-14 13:25:49 +00:00
parent a4da8cd41b
commit fa6ce67fba

View File

@ -48,7 +48,7 @@ import XMonad.Layout.LayoutModifier
data AutoMaster a = AutoMaster Int Float Float data AutoMaster a = AutoMaster Int Float Float
deriving (Read,Show) deriving (Read,Show)
instance LayoutModifier AutoMaster Window where instance (Eq w) => LayoutModifier AutoMaster w where
modifyLayout (AutoMaster k bias _) = autoLayout k bias modifyLayout (AutoMaster k bias _) = autoLayout k bias
pureMess = autoMess pureMess = autoMess
@ -61,12 +61,12 @@ autoMess (AutoMaster k bias delta) m = msum [fmap resize (fromMessage m),
resize Shrink = AutoMaster k (max (-0.4) $ bias-delta) delta resize Shrink = AutoMaster k (max (-0.4) $ bias-delta) delta
-- | Main layout function -- | Main layout function
autoLayout :: (LayoutClass l Window) => autoLayout :: (Eq w, LayoutClass l w) =>
Int -> Int ->
Float -> Float ->
W.Workspace WorkspaceId (l Window) Window W.Workspace WorkspaceId (l w) w
-> Rectangle -> Rectangle
-> X ([(Window, Rectangle)], Maybe (l Window)) -> X ([(w, Rectangle)], Maybe (l w))
autoLayout k bias wksp rect = do autoLayout k bias wksp rect = do
let stack = W.stack wksp let stack = W.stack wksp
let ws = W.integrate' stack let ws = W.integrate' stack