
On Wed, Sep 05, 2007 at 12:28:08PM -0700, David Roundy wrote:
Hi all,
Here's a proposed change for the Layout API. I'm not yet sending updates for XMonadContrib, since I'd rather first hear what folks think. The idea is to disallow changes to the XState in Layout hooks, so we won't run into trouble with the state changing while we're in the process of updating said state. Basically, as far as I can tell, this is needed in order for the current Layouts API to be safe.
A catch is that some existing Layout code will break. I would say that that code is fragile and really wants a generic hooks API. As far as I know, the modules that I maintain will work with this change. Any Layout that just lays out windows and does IO stuff will still work (e.g. even weird ones like WorkspaceDir won't be broken). But, for example, Andreas' focus-follows-mouse Layout will break, since it relies on modifying the XState (to change focus) within the Layout (which is also why it breaks when combined with other Layouts).
I look forward to discussion. In my opinion, we really need a cleaner Layout API.
I agree with you: enforcing a safer API with a read-only monad is something we need, I believe. As you noticed, my attempts with focus-follows-mouse show a real bad method of messing up layouts. I think that something like that should be ruled by the API itself, if possible. Just my 2 cents. Andrea