[Xmonad] moving layouts to Workspace

David Roundy daveroundy at gmail.com
Mon Aug 20 21:17:45 EDT 2007

Hi all,

I've been thinking that we'd be better off if the contents of layouts were
moved to Workspace, something like

data Workspace i l a = Workspace  { tag :: !i, layouts :: (l a,[l a]), stack :: StackOrNot a }
    deriving (Show, Read, Eq)

Thus the layout for each workspace would be stored with that workspace.
This seems cleaner than the current approach of using a Data.Map.Map to
figure out what the layout is for each workspace, since the data type would
enforce that a layout exists for each workspace, rather than relying on an
invarient that each workspace must have an entry in the map (an invarient I
broke while writing DynamicWorkspaces, embarassingly crashing xmonad).

This change would be pretty pervasive, and a fair amount of work, so I'm
not keen on making it unless there's some sort of consensus that it looks
like a good idea.  Personally, I think it'll be far more beautiful.  There
*are* bits of code that'll get trickier (e.g. Operations.broadcastMessage).
But in my mind any such complexities are outweighed by the greater
modularity, that one can modify a Workspace in isolation--and in a way that
doesn't cause xmonad to crash when the workspace ids get out of sync with
the contents of the Data.Map layouts.
David Roundy

More information about the Xmonad mailing list