[Xmonad] darcs patch: Added LayoutMessages

David Roundy droundy at darcs.net
Mon Sep 24 10:46:29 EDT 2007


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?

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.

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.

> This way we can have a non flickering tabbed, with proper handling of
> fontStruct and windows, but without having to recreate/destroy these
> resources at every refresh.

That'll definitely be good.

> 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.
-- 
David Roundy
Department of Physics
Oregon State University


More information about the Xmonad mailing list