[xmonad] How to configure TwoPane to this way

Chengqi Song songcq at gmail.com
Sun Mar 21 12:34:13 EDT 2010


Thanks for your analysis. The layout is like this:

1. It always has two panes, left and right;

2. Suppose we have windows A, B, C, D and E; currently left pane displays A and right pane displays B; A is focused:
   (A)|B [C, D, E]
   window in () is focused, windows in [] are not visible;

3. When pressing M-J/K, left pane switches between all windows expect B, focus in always on left pane.
   so it can become:
   (C)|B [A, D, E]
   (D)|B [A, C, E]
   (E)|B [A, C, D]

4. When pressing M-S, focus switches between left and right pane.
   so it can become:
   A|(B) [C, D, E]

5. When focus is on right pane, when pressing M-J/K, right pane switches between all windows expect A:
   A|(C) [B, D, E]
   A|(D) [A, C, E]
   A|(E) [A, C, D]

Is there any solution for this requirement?

lars

On Sat, 20 Mar 2010, Adam Vogt wrote:

> * On Saturday, March 20 2010, Chengqi Song wrote:
> 
> >Hi All,
> >
> >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.
> >
> >best
> >lars
> 
> These can all be accomplished by manipulating the ordering in the
> StackSet.
> 
> 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).
> 
> --
> Adam


More information about the xmonad mailing list