[Xmonad] help with layout modifiers

Andrea Rossato mailing_list at istitutocolli.org
Wed Aug 29 13:09:04 EDT 2007

On Wed, Aug 29, 2007 at 12:16:35PM -0400, David Roundy wrote:
> You can see the problem (yes, I'm spending even more time on this...) in
> sendMessage :: Message a => a -> X ()
> sendMessage a = do n <- (W.tag . W.workspace . W.current) `fmap` gets windowset
>                    Just (l,ls) <- M.lookup n `fmap` gets layouts
>                    ml' <- modifyLayout l (SomeMessage a) `catchX` return (Just l)
>                    whenJust ml' $ \l' -> do modify $ \s -> s { layouts = M.insert n (l',ls) (layouts s) }
>                                             refresh
> We read the current layout l, then we call modifyLayout, and if that gives
> us a new layout, we proceed to update the layout using the return value of
> modifyLayout.  But if modifyLayout itself *already* changed the layout,
> that change will be lost!
> So what we've got is a rather complicated and unchecked constraint on
> layout behavior.  :(
> My best guess as to a solution would be to enable a simple locking
> mechanism such that we can keep layouts from being modified or used while
> they're already being modified.

I had the feeling that I was hitting a limit but I could not track
down its origin. Now I understand the problem. Thanks for your time.

I hoped it could be possible to modify the layout, refresh and return
the modified layout *within* modifyLayout...

I think I'll try to find a solution myself. I doubt I'll actually find


More information about the Xmonad mailing list