[Xmonad] darcs patch: Added LayoutMessages

Andrea Rossato mailing_list at istitutocolli.org
Mon Sep 24 11:05:26 EDT 2007

On Mon, Sep 24, 2007 at 07:46:29AM -0700, David Roundy wrote:
> On Mon, Sep 24, 2007 at 04:20:32PM +0200, Andrea Rossato wrote:
> > Hi,
> > 
> > as we said yestarday this is my proposal for a more sophisticated
> > layour message system.
> > 
> > Basically: UnDoLayouts is used for refreshes, LayoutSwitch wfor
> > notifying a layout change, and NonVisible when a layout is a workspace
> > not visible anymore.
> I don't see why we need so many messages.  It seems like UnDoLayouts should
> now be unused, and NonVisible should be treated the same as LayoutSwitch.
> Do you have a use case where these should be treated differently?

Two messages would actually be fine for me. The problem is that I
would like to know when I must hide and when I must free the

When we change layout we now send a "UnDoLayout", and we send the same
in Operations.windows before updating the state.

I also have the Read instance problem, which I did not study carefully
yet. If I want to cache the fontStruct/Set together with the window
ids, I would like to know when XMonad is going to be restarted. The
cache is done in a Maybe type and I would like to free all the
resources and return a Tabbed Nothing TConf, which could be read (am I
guessing right here?).

> However, it might be nice to have a Focus/NonFocus message.  This would
> allow WorkspaceDir to work properly with multiple screens.  A related
> (and perhaps better) possibility would be to create a different method in
> Layout for drawing focussed stacks versus unfocussed stacks.  The default,
> of course, would be for both to be drawn the same.

Neither solves the release/hide resources issue, btw.

> class (Show (layout a), Read (layout a)) => Layout layout a where
>     doLayout :: layout a -> Rectangle -> Stack a -> X ([(a, Rectangle)], Maybe (layout a))
>     doFocusLayout :: layout a -> Rectangle -> Stack a -> X ([(a, Rectangle)], Maybe (layout a))
>     doFocusLayout = doLayout
>     modifyLayout :: layout a -> SomeMessage -> X (Maybe (layout a))
>     modifyLayout _ _ = return Nothing
> Actually, I think this is exactly how I'd like to handle focus.
> But I really don't see a use case for NonVisible vs UnDoLayouts vs
> LayoutSwitch, and am not keen on sending and defining messages without an
> envisioned use case.  If some day someone comes up with an idea that
> depends on distinct NonVisible and LayoutSwitch messages, we could easily
> split them apart, but until then, I'd prefer to have a single message sent.
> At a minimum, I'd vote for eliminating UnDoLayouts.

In which case how would you suggest to handle the specific problem of

> > There is a new function sendMessage', for sending messages to a list
> > of layouts.
> Sounds good.  Maybe rename this to sendMessageToWorkspaces? I know I'm as
> guilty as anyone with regard to foo' naming, but I think
> sendMessageToWorkspaces would a bit better describe what this function
> does.



More information about the Xmonad mailing list