benweitzman / BinarySpacePartition

XMonad Layout
40 stars 5 forks source link

Make any pane the master (feature request) #7

Open thblt opened 8 years ago

thblt commented 8 years ago

BSP considers the top-left pane to be the master pane. Given its high configurability, this default does not always make sense. I'm often finding myself with window organization such as:

+----+--------------------------+----+
| M  |                          |    |
|    |                          |    |
|    |                          |    |
|    |                          |    |
+----+                          +----+
|    |                          |    |
|    |                          |    |
|    |                          |    |
|    |                          |    |
+----+-------------------------------+

where it doesn't really make sense that the top-left pane be the master. BSP's logic would allow any pane to be considered master, giving back the statute to its parent when its gets destroyed, and so on.

Is there a way to provide a message (in a way similar to SelectNode/MoveNode) that would give master status to the currently focused pane? I have had a look at the code, but I really don't understand enough of XMonad's internals to try to implement this myself.

Finally, thanks a lot for BSP. It has been the only layout I've been needing since I tried it.

benweitzman commented 8 years ago

Sorry for the delay, this is a great idea! I'll try and implement it this week.

nbeirne commented 8 years ago

I'm looking at this now. Ideally the Stack passed in to doLayout could be in any order, so we can accommodate stuff like shifting the most recent window to be the master. The only way I could think of doing it is very dirty, but should work.

The basic idea is to associate the Stack's windows to their previous rectangles in getOldRects. There is a way to associate the correct window to the correct rectangle - but it's messy and it involves comparing rectangle sizes. It works in the insertion and deletion case, but I'm not sure about some edge cases.

I can make an implementation of this logic, but it has to be throughly tested.

Edit: Nevermind, my solution will not work. It relies too much on the Windows being the same, and will lead to weird cases when xmonad is restarted / switching layouts.