[xmonad] How to configure TwoPane to this way
vogt.adam at gmail.com
Sat Mar 20 13:28:44 EDT 2010
* On Saturday, March 20 2010, Chengqi Song wrote:
>I like the TwoPane layout, but need to special configuration:
>Suppose we have windows A, B and C. Now A is on left pane and focused, B is on
>right pane, C is not visible:
> (A) | B, C
>Now I need a special HotKey, when triggered, it keeps B untouched, just switch
>between A and C on the left pane.
>And I also want another HotKey to switch between left and right pane.
>Is that doable?
>I need it a lot, thanks very much.
These can all be accomplished by manipulating the ordering in the
You'll have to decide what is to happen with more windows, when:
(A) | B, C, D
So does it mean going through these steps:
A | (D), B, C -- insert D above B, swapping the order of B C to C B
-- is also possible, but not done here.
> promoteLast :: W.Stack a -> W.Stack a
> promoteLast (W.integrate -> a:(reverse -> l:ls)) =
> maybe undefined W.focusDown (W.differentiate (a:l:reverse ls))
> promoteLast a = a
promoteLast' probably doesn't deserve a name, but it should be enough of
a hint for adding keybindings.
> promoteLast' :: X ()
> promoteLast' = windows (W.modify' promoteLast)
Then to go back put the second window from the top at the end:
A | (D), B, C
(A) | B, C, D
> toEnd :: W.Stack a -> W.Stack a
> toEnd (W.integrate -> a:d:rest) = fromJust (W.differentiate (a:rest ++ [d]))
> toEnd a = a
> toEnd' :: X ()
> toEnd' = windows (W.modify' toEnd)
I'm not sure what you want by switching between the left and right
panes, in that what's supposed to happen when you start here:
A | B (C) D
Then 'switch' to the A, then press M-j, then M-k. Do you end up back at
A, was the intermediate B or was it C?
Depending on how you answer (I can't think of any reason to choose one
option over the other), you may have to store some additional state,
either as a layout that calls TwoPane, or as some code that calls some
state defined in XMonad.Util.ExtensibleState (not released yet).
More information about the xmonad