[xmonad] my proposal for a Xinerama safe PerWorkspace
Spencer Janssen
sjanssen at cse.unl.edu
Tue Feb 26 21:27:26 EST 2008
On Fri, Feb 22, 2008 at 07:12:31PM +0100, Andrea Rossato wrote:
> Hi,
>
> this is my proposal for a Xinerama safe PerWorkspace.
>
> It includes a new LayoutClass method:
>
> runLayout :: Workspace WorkspaceId (layout a) a -> Rectangle -> X ([(a, Rectangle)], Maybe (layout a))
>
> This is just some code moved around:
>
> Fri Feb 22 18:58:15 CET 2008 Andrea Rossato <andrea.rossato at unibz.it>
> * runLayout is now a LayoutClass method and takes the Workspace and the screen Rectangle
> M ./XMonad/Core.hs -7 +7
> M ./XMonad/Operations.hs -5 +5
>
>
> This is the patch to PerWorkspace:
>
> Fri Feb 22 18:59:54 CET 2008 Andrea Rossato <andrea.rossato at unibz.it>
> * PerWorkspace: reimplemented using runLayout
> This way we have a Xinerama safe PerWorkspace and the emptyLayout
> method for free.
> M ./XMonad/Layout/PerWorkspace.hs -73 +27
>
> Some lines were left there just because I'm lazy....;)
>
> Cheers,
> Andrea
>
>
> ps: I must confess that if the runLayout method could be accepted in
> the core my request of changing the 'description' type would be gone.
> While my sense of symmetry would require it for implementing a
> LayoutCombinator class as I have it mind, still I'm coming to thing
> that, from the practical point of view, the restrictions imposed by
> that signature are irrelevant for our purposes. And, probably, the
> fact of restricting the class to what I call pure combinators only,
> would be just fine.
>
> This is quite a common pattern of mine when it comes to type classes:
> I cannot see where I'll end up when I start implementing them. There
> must be some hidden weirdness I cannot grasp entirely.
> ;)
I'm not sure that I'm comfortable with this style of extension. Consider the
existing pureLayout/doLayout functions in the layout class. Outside consumers
of the API can really only use doLayout, because pureLayout often has the
garbage default implementation. Here we're just adding another layer, meaning
that layout combinators and such can't safely use doLayout anymore, they must
be updated to use runLayout. It just seems like this style of API just isn't
very nice.
Cheers,
Spencer Janssen
More information about the xmonad
mailing list