CycleRecentWS with nonempty workspaces only

I would like to have cycleRecentWS of XMonad.Actions.CycleRecentWS to cycle the nonempty workspaces only. Can anybody point my the way to achieve this? (The conventional if-then stuff is a mystery in haskell;-)) Thanks in advance. Ralph

Excerpts from Ralph Hofmann's message of Sat Jan 23 03:02:43 -0700 2010:
I would like to have cycleRecentWS of XMonad.Actions.CycleRecentWS to cycle the nonempty workspaces only. Can anybody point my the way to achieve this? (The conventional if-then stuff is a mystery in haskell;-))
That's a neat idea. I'm sort of surprised no one seems to have asked for it before. Since my haskell and xmonad hacking are a bit rusty there's likely a better way to do this, but I've attached an example file with some helper functions and keybindings showing how to use cycleWindowSets from CycleRecentWS to do what you want. Although it could be tweaked to act differently on the other visible workspaces with multi-head, the example focuses them in turn, but never moves a visible workspace to another screen, which seems like the nicest alternative overall. The key to making sense of the code is that empty workspaces have Nothing for their Stacks, so using pattern matching and a list comprehension is one clear and simple way to get the tags of the nonempty workspaces in the right order. Then cycleRecentWS uses that list to generate a list of windowsets for each choice you could make while cycling in "preview" mode. The example is liberally commented, but please ask if it's unclear how any of the parts work or fit together to produce the final result. regards, -- wmw

Thank you very much. It works perfectly (after adding a final "l", which probably hadn't survived copy and paste). In order to completely understand the code, I think I have to take a closer look on XMonad.StackSet at first. I will take this piece of code as entry point. Greetings, Ralph Am Samstag, den 23.01.2010, 14:32 -0700 schrieb Wirt Wolff:
Excerpts from Ralph Hofmann's message of Sat Jan 23 03:02:43 -0700 2010:
I would like to have cycleRecentWS of XMonad.Actions.CycleRecentWS to cycle the nonempty workspaces only. Can anybody point my the way to achieve this? (The conventional if-then stuff is a mystery in haskell;-))
That's a neat idea. I'm sort of surprised no one seems to have asked for it before. Since my haskell and xmonad hacking are a bit rusty there's likely a better way to do this, but I've attached an example file with some helper functions and keybindings showing how to use cycleWindowSets from CycleRecentWS to do what you want. Although it could be tweaked to act differently on the other visible workspaces with multi-head, the example focuses them in turn, but never moves a visible workspace to another screen, which seems like the nicest alternative overall.
The key to making sense of the code is that empty workspaces have Nothing for their Stacks, so using pattern matching and a list comprehension is one clear and simple way to get the tags of the nonempty workspaces in the right order. Then cycleRecentWS uses that list to generate a list of windowsets for each choice you could make while cycling in "preview" mode. The example is liberally commented, but please ask if it's unclear how any of the parts work or fit together to produce the final result.
regards,

Excerpts from Ralph Hofmann's message of Sun Jan 24 02:59:10 -0700 2010:
Thank you very much.
It works perfectly (after adding a final "l", which probably hadn't survived copy and paste).
In order to completely understand the code, I think I have to take a closer look on XMonad.StackSet at first. I will take this piece of code as entry point.
Great, glad it works for you. Sorry about the missing "l", now I notice the commented default/additionalKeys style binding is wrong too. Apologies in advance to anyone who wastes time with the missing (,) for the modifier and keysym part of the binding; it should have been: ((modm, xK_Tab), cycleWindowSets nonEmptyRecents [xK_Super_L] xK_Tab xK_grave) So much for that "Attention to detail" section on my résumé. :_( -- wmw
participants (2)
-
Ralph Hofmann
-
Wirt Wolff