
On Wed, Jun 13, 2007 at 11:50:37PM +1000, Donald Bruce Stewart wrote:
Seems eminently reasonable. Though I wonder how we allow layouts to specify, combine, or override the tag type?
How do we take advantage of a more liberal tag type, or are we not looking that far ahead yet?
I'm not thinking that grandly (although it'd be exciting). I was just thinking that we could refactor the existing code so that instead of storing data XState = XState { ... , layouts :: !(M.Map WorkspaceId (Layout, [Layout])) -- | Virtual workspace indicies newtype WorkspaceId = W Int deriving (Eq,Ord,Show,Read,Enum,Num,Integral,Real) we define something like (and this is a sketch, not a proposed naming scheme) data WorkspaceId' = Tag WorkspaceId (Layout, [Layout]) so that we don't need the layouts field in XState. Then we have type WindowSet = StackSet WorkspaceId' Window ScreenId and when we want the layout for a given workspace, it's right there in the tag. We'd need to be careful when comparing tags (e.g. when selecting a given workspace) to only compare the WorkspaceId portion of it. But we could do this with no change in functionality and almost no change in layouts code. We'd eliminate one field from XState and have one less Map to keep in sync with the rest of the code. With the cleaner data structure, we could introduce dynamic addition and deletion of workspaces in a way that is completely implementable in the pure StackSet and checkable by quickcheck tests. Of course, we could also just be mundane and switch the tag to a String, which I imagine would enable simplifications and beautifications in your status bar extensions, since users could just specify in their Config file once and for all that they want workspaces ["mutt","iceweasel",...]. Even with this minor feature, we'd be tempted to add similar functionality to StackSet to what we'd want for the ambitious Layout idea above: the first feature I'd be interested in (or second) would be the ability to change the tag of a workspace, since I don't know in advance what I'll be working on. This wouldn't be hard. -- David Roundy http://www.darcs.net