
* Adam Vogt
* On Monday, March 30 2009, Konstantin Sobolev wrote:
Hello
I'm trying to implement my own LayoutClass which mixes the ideas of IM and CombineTwo. It has to contain some predicate as a part of it's state, which will tell where to put new windows. As I see IM uses WindowProperties for this purpose, but I wouldn't like to use it for 2 reasons: 1. Property essentially duplicates Query Bool. 2. Property isn't flexible enough. For instance, I can't match a window by title substring, while I can easily do it with Query. However, there's one problem (and I guess that's why Property was introduced): Query doesn't derive Read and Show, and as far as I understand it's not so easy to implement them. So what should I use, Query Bool with empty (Read, Show)
Another way to pass a function (that is not changed by running the layout), is to use a typeclass:
class IsAQuery a where query :: a -> Query Bool
data Dummy = Dummy deriving (Read,Show)
instance IsAQuery Dummy where query _ = do ..... query stuff
data QLayout q a = QLayout q deriving (Read,Show) instance (Reqd q, Show q, IsAQuery q) => LayoutModifier (QLayout q) a where ....
These ideas were used to extend XMonad.Layout.NoBorders (the patch is applied in darcs).
Very nice. Another solution is desribed here: http://hackage.haskell.org/trac/summer-of-code/ticket/1575 -- Roman I. Cheplyaka (aka Feuerbach @ IRC) http://ro-che.info/docs/xmonad.hs