[xmonad] How to configure TwoPane to this way

Wirt Wolff wirtwolff at gmail.com
Mon Mar 22 00:45:04 EDT 2010

Excerpts from Chengqi Song's message of Sun Mar 21 10:34:13 -0600 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?

Hi lars,

For the TwoPane binding on M-J/K, if I understand what you want, then
rotFocusedUp and rotFocusedDown from XMonad.Actions.CycleWindows should
do it. So if you use those on "M-j" "M-k" you'd be rebinding those to
act differently in all layouts. When I used to use TwoPane most all the
time, I put rotFocused bindings on M-U/I to keep using M-J/K in other
tiling layouts, but you could get fancier to have less key bindings
(see below).

For the M-S switch this is the version I used to use:
i.e. ("M-s", windows (W.modify' switchTP))

switchTP (W.Stack t [] (r:rs)) = W.Stack r [t] rs   -- master focused
switchTP (W.Stack t [l] rrs) = W.Stack l [] (t:rrs) -- other focused
                -- TwoPane never has more than one above focus
switchTP s = s  -- do nothing if one window or not TwoPane-ish

Hopefully that is good enough for that part of what you're wanting.

If having the same key actions for all layouts doesn't work so well
for you, you could perhaps:

* Put layouts that all work well with the TwoPane bindings on a few
workspaces only, with Layout.PerWorkspace. Then you can use
Actions.PerWorkspaceKeys to have the TwoPane key bindings only on
those workspaces.

* Get a modified version of PerWorkspaceKeys working with layout
descriptions rather than workspace tags so that your key bindings
run TwoPane actions only in TwoPane layout variations and otherwise
run defaults. (Attached is long abandoned ConditionalKeys experiment
that shows over-complicated clues about how to do that.)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ConditionalKeys.hs
Type: application/octet-stream
Size: 3269 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/xmonad/attachments/20100322/e7ea7411/ConditionalKeys.obj

More information about the xmonad mailing list