complexity of 'windows'

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.

lowlycoder:
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.
It's the function that flushes the window set model out to actual X server effects on the world. It has to map our abstract understanding of the state of the X server to real bits flipped in xorg. We hide all the evil state manipulation in one place, rather than sprinkling it throughout the beautiful model. -- Don

It's dons! This is like the source for xmonad.
I have a favor to ask .. can you give me a modifier version of 'windows'
that takes another argument (a workspace to apply it to); thus allowing me
to manipulate WindowSet for something other than W.current ?
Thanks
On Tue, Feb 17, 2009 at 2:40 PM, Don Stewart
lowlycoder:
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.
It's the function that flushes the window set model out to actual X server effects on the world. It has to map our abstract understanding of the state of the X server to real bits flipped in xorg.
We hide all the evil state manipulation in one place, rather than sprinkling it throughout the beautiful model.
-- Don

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

* lowly coder
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?
windows isn't WindowSet -> WindowSet. It's (WindowSet -> WindowSet) -> X (). You provide it a function WindowSet -> WindowSet (as simple as you want) and it then transforms the world according to it. (other questions seem to be already answered) -- Roman I. Cheplyaka (aka Feuerbach @ IRC) http://ro-che.info/docs/xmonad.hs
participants (4)
-
Don Stewart
-
lowly coder
-
Roman Cheplyaka
-
Spencer Janssen