[xmonad] specific layout per workspace

David Roundy droundy at darcs.net
Mon Nov 19 15:39:45 EST 2007


On Mon, Nov 19, 2007 at 02:13:41PM -0500, Brent Yorgey wrote:
> On Nov 19, 2007 1:45 PM, Brent Yorgey <byorgey at gmail.com> wrote:
> 
> >
> > On Nov 19, 2007 12:11 PM, Don Stewart <dons at galois.com> wrote:
> >
> > > lobzang:
> > > > Hi guys,
> > > >
> > > > Is there any way to configure xmonad in order to have a custom layout
> > > per
> > > > workspace, for exemple :
> > > > workspace 1 (xterm) : Layout $ Mirror tiled
> > > > workspace 2 (web)   : Layout Full
> > > > workspace 3 (icq)   : Layout tiled
> > >
> > > This is a great idea, I wonder why we haven't thought of it before!
> > > There /must/ be a way to do it. Anyone have some thoughts?
> >
> > Hmm, it seems like it would be possible to create a LayoutClass instance
> > for something like (WorkspaceId -> Layout Window), which does layout by
> > first getting the state from the X monad and using the current workspace id
> > to select the layout to use.  Perhaps I'll take a crack at it, unless
> > someone thinks this isn't a good idea for some reason.
> 
> I just realized this would cause major problems for serializing layout
> state!  Perhaps a Map from WorkspaceId to Layouts would work -- slightly
> less flexible, but it would work with serialization/layout preservation
> across restarts.
> 
> Anyone have any comments/thoughts?

I'd prefer a function :: WorkspaceId -> Layouts rather than a Map.  A Map
will always leave you with possible runtime failure cases.  A function
might be incomplete, but that's not as bad (in my opinion).

Serialization here is an interesting problem.

One option would be to create a container type that can contain various
types of layouts, something like a variant of Choose which can have one of
its layouts disabled.  This would allow us to avoid having any changes in
the serialization code, and would also work nicely with dynamic changes of
layout options (removing or adding options from a given layout).  I have no
idea how it can be made palatable in the config file... but I've got to go
now.
-- 
David Roundy
Department of Physics
Oregon State University


More information about the xmonad mailing list