How to configure TwoPane to this way

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

* 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

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

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.) -- wmw

It seems that rotFocusedDown rotFocusedUp can meet your requirements.
http://hackage.haskell.org/packages/archive/xmonad-contrib/0.9/doc/html/XMon...
On Mon, Mar 22, 2010 at 12:45 PM, Wirt Wolff
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.) -- wmw
_______________________________________________ xmonad mailing list xmonad@haskell.org http://www.haskell.org/mailman/listinfo/xmonad
-- Sincerely, Ian Yang

Cool, rotFocusedDown and Up works for me. I'm trying to get Keybinding per Layout work On Sun, 21 Mar 2010, Wirt Wolff wrote:
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.) -- wmw
participants (4)
-
Adam Vogt
-
Chengqi Song
-
Ian Yang
-
Wirt Wolff