[xmonad] complexity of 'windows'

Spencer Janssen spencerjanssen at gmail.com
Tue Feb 17 18:05:40 EST 2009


On Tue, Feb 17, 2009 at 02:39:07PM -0800, lowly coder wrote:
> I'm looking at the 'windows' function, and do not understand why it's so
> complicated. If it's just WindowSet -> WindowSet ... why is it so long?
> 
> I ask this because I want to manipulate the WindowSet of a workspace that is
> _NOT_ visible; the only function that is WindowSet -> WindowSet is
> "windows". However, windows has W.current hard coded into it -- and I'm not
> sure what all of the other stuff in there is.

You seem to have some misconceptions about WindowSet.  A WindowSet encompasses
all workspaces: current, visible and non-visible.  The idiom for modifying
non-current workspaces is to first view it, perform the modification, then view
the previously viewed workspace.  For example:

    onWorkspace :: WorkspaceId -> (WindowSet -> WindowSet)
                -> (WindowSet -> WindowSet)
    onWorkspace wsid f w = view (currentTag w) . f . view wsid $ w

(actually, this should probably be a primitive in XMonad.StackSet)


Cheers,
Spencer Janssen


More information about the xmonad mailing list