[Xmonad] darcs patch: refactor layout interface. (and 1 more)

Jason Creighton jcreigh at gmail.com
Wed Apr 18 21:06:11 EDT 2007

On Wed, Apr 18, 2007 at 09:05:56AM -0700, David Roundy wrote:
> hunk ./Operations.hs 49
> -            case layoutType fl of
> -                Full -> fmap (flip (,) sc) $ maybeToList $ W.peekStack n ws
> -                Tall -> tile  (tileFraction fl) sc $ W.index n ws
> -                Wide -> vtile (tileFraction fl) sc $ W.index n ws
> +            (doLayout l) sc $ W.index n ws
>          whenJust (W.peekStack n ws) (io . raiseWindow d)
>      whenJust (W.peek ws) setFocus
>      clearEnterEvents
> hunk ./Operations.hs 54
> +full :: Layout
> +full = Layout { doLayout = \sc -> map (\w -> (w,sc)), modifyLayout = const Nothing }

If I'm reading this correctly, I don't think that will work. "full"
doesn't display the first window in the tiling order, it displays the
focused window. So Rectangle -> [Window] -> [(Window, Rectangle)] is not
sufficient to support all the cases we have now: The layout function has
to somehow know which window is focus. To that end, I think the layout
function type is going to have to be something like

Rectangle -> Workspace -> [(Window, Rectangle)]

...where "Workspace" is a magical, as-yet-non-existent datatype that
contains a list of windows, which one is focused and the layout
description. (Possibly other stuff; that's all I can think of ATM.) And
of course StackSet would have to be modified to use "Workspace".

In that scenario, I'm not quite sure where you'd want to parameterize
your user-defined message type. Indeed, I'm not quite sure what to do
about that in the first place. If the whole X monad takes this type,
doesn't that mean that you made up a totally new type, you couldn't mix
and match your layout functions with the builtin ones?

Jason Creighton

More information about the Xmonad mailing list