mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 11:30:22 -07:00
Generalize X.L.AutoMaster modifier
Enable it to work not only with Windows, but with any (Eq) type.
This commit is contained in:
parent
a4da8cd41b
commit
fa6ce67fba
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user